Skip to content

Instantly share code, notes, and snippets.

@creationix
Created July 6, 2013 02:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save creationix/5938450 to your computer and use it in GitHub Desktop.
Save creationix/5938450 to your computer and use it in GitHub Desktop.
Talking to tinyduino over firmatta using johnny-five.
var five = require('johnny-five');
var board = new five.Board();
board.on("ready", function () {
var leds = new Array(5);
for (var i = 0; i < 5; i++) {
leds[i] = new five.Led({pin: i + 5});
}
setInterval(function () {
for (var i = 0; i < 5; i++) {
var on = Math.random() > 0.5;
leds[i][on ? "on" : "off"]();
}
}, 33);
});
@creationix
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment