Skip to content

Instantly share code, notes, and snippets.

@taterbase
Created July 11, 2013 22:17
Show Gist options
  • Save taterbase/5979742 to your computer and use it in GitHub Desktop.
Save taterbase/5979742 to your computer and use it in GitHub Desktop.
var five = require("johnny-five")
, board = new five.Board()
, leds = [2, 3, 4, 5, 6, 7, 8, 9]
board.on("ready", function() {
var led = new five.Led(6)
this.repl.inject({unlockDoor: unlockDoor.bind(this, led)})
})
function unlockDoor(led) {
led.on()
this.wait(4000, function() {
led.off()
})
}
function dance(led, board) {
led.on()
board.wait(100, function() {
led.off()
})
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min) + min)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment