Created
December 1, 2012 16:43
-
-
Save rhumlover/4183174 to your computer and use it in GitHub Desktop.
Arduino Daily FTW !
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 five = require("johnny-five"), | |
board, button, buttons; | |
board = new five.Board(); | |
board.on("ready", function() { | |
var clients = { | |
'jonjon': 12, | |
'nadir': 11, | |
'francois': 10 | |
}; | |
var buttons = {}, | |
onDown = function onDown(e) { | |
console.log('down: ' + this.displayName); | |
}, | |
onUp = function onUp(e) { | |
console.log('up: ' + this.displayName); | |
}; | |
for (var client in clients) { | |
var key = clients[client], | |
bt = new five.Button(key); | |
bt.displayName = client; | |
bt.on('down', onDown); | |
bt.on('up', onUp); | |
buttons[client] = bt; | |
} | |
board.repl.inject(buttons); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment