Created
July 25, 2015 21:55
-
-
Save johnnyji/0702881d70d632bc3f01 to your computer and use it in GitHub Desktop.
It's Party Time
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
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