Coder Social home page Coder Social logo

easy-usb-relay's Introduction

easy-usb-relay

THIS IS CURRENTLY IN AN EXPERIMENTAL STATE: It does not yet support multiple boards or other manufacturers. Coming soon...

A Node.js library to control USB connected relays

Setup

npm install --save easy-usb-relay

Usage

const { Board } = require('easy-usb-relay')

const numRelays = 2
const relays = new Board(numRelays)

// Turn all relays off:
relays.allOff()

// Turn all relays on:
relays.allOn()

// Turn relay #1 on:
relays.on(1)

// Turn relay #1 off:
relays.off(1)

Please see examples directory for more examples on using easy-usb-relay

API

relays.allOff()

Turn all relays off.

relays.allOn()

Turn all relays on.

relays.on(index)

Turn relay with index on. Index starts at 1 and goes to the number of available relays. Throws an exception if the relay index is greater than the available number of relays.

relays.off(index)

Turn relay with index off. Index starts at 1 and goes to the number of available relays. Throws an exception if the relay index is greater than the available number of relays.

Contribute

Contributions welcome! Please submit a Pull Request and make sure to format your code with Prettier and write tests!

License

MIT

Credits

© Dana Woodman 2018

easy-usb-relay's People

Contributors

danawoodman avatar zyphlar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

zyphlar

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.