Created
March 9, 2015 04:30
-
-
Save chrismatthieu/8c6b8b3731d3ebd03686 to your computer and use it in GitHub Desktop.
cylon / skynet iteration question...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my.skynet.on('message', function(data) { | |
// interate on array of pins | |
// data = [{"pin":9, "mode":1, "value":1}, {"pin":13, "mode":1, "value":1}] | |
// where do I listen to skynet messages and where do i set the pins and as interating on this array | |
// }); | |
var Cylon = require('cylon'); | |
Cylon.robot({ | |
connections: { | |
arduino: { adaptor: 'firmata', port: '/dev/tty.usbmodem1411' }, | |
skynet: { adaptor: 'skynet', uuid: "db895340-c344-11e4-9f09-df7578d68eac", token: "d0a9f0d7e321657a38d25dd492492ffed0baf773" } | |
}, | |
// interate through array of pins | |
devices: { | |
pin: { driver: 'direct-pin', pin: ? } | |
}, | |
work: function(my) { | |
// Modes: 0=input, 1=output, 2=analog, 3=pwm, 4=servo | |
if mode == 0 { | |
my.pin.digitalRead(value); | |
} else if mode == 1 { | |
my.pin.digitalWrite(value); | |
} | |
} | |
}).start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment