Skip to content

Instantly share code, notes, and snippets.

@johnnyji
Created July 25, 2015 21:56
Show Gist options
  • Save johnnyji/de3780996f1e46a0aae6 to your computer and use it in GitHub Desktop.
Save johnnyji/de3780996f1e46a0aae6 to your computer and use it in GitHub Desktop.
It's Party Time
var sys = require("sys");
var exec = require('child_process').exec;
var five = require('johnny-five');
var board = new five.Board();
function puts(err, stdout, stderr) { sys.puts(stdout) };
board.on('ready', function() {
console.log("board ready");
var button = new five.Button(5);
var led = new five.Led(9);
button.on("press", function() {
led.toggle();
});
button.on("hold", function() {
exec("say its party time", puts);
led.strobe(100);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment