Giter Site home page Giter Site logo

fescron / dfrobot-rly8-python3 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5 KB

DFRobot RLY-8 8 channel PoE ethernet controller Python 3 Control Class and Example Code

License: MIT License

Python 100.00%
controller dfrobot poe python python3 relay rly-8 usb rly8 ethernet json

dfrobot-rly8-python3's Introduction

DFRobot RLY-8 Python 3 Control Class and Example Code

This repository contains a control class and other example code for the RLY-8 8 channel PoE ethernet (and USB) relay controller by DFRobot. See this link to their wiki-page for more information about the device.

The code on this repository was originally written by Geréb Róbert in Python 2 (see this repository). I've ported it to Python 3 and added slightly more functionality and documentation.


Repository Files

  • RLY8Class.py: Control class for the relay
  • main.py: A basic Python-file which uses the RLY8Class.py file to control the relay
  • rly-8.py: Stand-alone example to control the relay

RLY8Class.py usage

from RLY8Class import RLY8

# Define the IP and port to connect to
# (DHCP is enabled by default, unfortunately the device doesn't have a hostname)
ADDR = ("192.168.0.202", 2000)

# Instantiate the RLY-8 object
rly8 = RLY8(ADDR)

# Print some information
print(rly8.name)
print(rly8.netconf)
print(rly8.version)
print(rly8.baudrate)

# Change some basic settings
rly8.setName("DFRobot2") # Default: "DFRobot"
rly8.setBaudrate(9600)   # Default: 115200

# Enable a relay (relays are numbered 1 to 8, states are "on" or "off")
rly8.setRelayStatus(1, "on")

# Print the status of a relay
print(rly8.relay1)

dfrobot-rly8-python3's People

Contributors

fescron avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.