hybridgroup / cylon-gpio

Cylon drivers for GPIO devices
http://cylonjs.com
Other
19 stars 14 forks source link

Adds support for Relay boards. #45

Closed juliancheal closed 9 years ago

juliancheal commented 9 years ago

Adds support for both Normally Open and Normally Closed relay boards. Can change between the type at creation so that the on/off/toggle functions are mapped correctly, defaults to Normally Open.

Usage

var Cylon = require('cylon');

// Initialize the robot
Cylon.robot({
  connections: {
    arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' }
  },

  devices: {
    relay: { driver: 'relay', pin: 13, type: "NC" }
  },

  work: function(my) {
    every((1).second(), function() {
      my.relay.toggle();
    });
}).start();
deadprogram commented 9 years ago

Very cool, thanks @juliancheal