Giter Club home page Giter Club logo

numato_control's Introduction

numato_control

Python control library for Numato relay hardware.

Originally built as a basic monitor and control tool for the Numato 2 Channel USB Relay Module, it should be usable on almost any Numato USB device that uses the same serial command scheme.

Currently supports retrieving status and writing to any relay on the device.

Supports Python versions between 2.7.x and 3.4 (Due to use of the enum34 library)

Later versions of Python should work with the built in enums.

Example Use:


# Defaults to port /dev/ttyACM0
from numato.numato_controller import numato_controller

device = numato_controller()

device.get_relay_state(0)  # Retrieve state of relay index 0
<RelayState.RELAY_OFF: (0, 'off')>

device.turn_on_relay(0)  # Turn on relay index 0
device.write_relay_state(relay_index=1, new_state=0)  # Turning off relay index 1

device.get_relay_state(0)
<RelayState.RELAY_ON: (1, 'on')>

device.write_gpio_state(gpio_index=0, new_state=1) # Setting (high) GPIO index 0
device.write_gpio_state(gpio_index=1, new_state=0) # Clearing (low) GPIO index 1

device.get_gpio_state(gpio_index=1)
<GPIOState.GPIO_LOW: (0, 'clear')>

device.read_adc(gpio_index=0)
1023

Testing

To execute the tests, from the repository root, use python -m unittest:


~$ python -m unittest
.......
----------------------------------------------------------------------
Ran 7 tests in 0.805s

It is also possible to use other tools such as pytest and nose2

numato_control's People

Contributors

jjmilburn avatar cdleonard avatar charithjp avatar bsilverthorn 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.