Skip to content

Instantly share code, notes, and snippets.

@Jaspur
Last active May 5, 2017 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaspur/d6e35e2574a8b0e6a80f6bc334bb02b2 to your computer and use it in GitHub Desktop.
Save Jaspur/d6e35e2574a8b0e6a80f6bc334bb02b2 to your computer and use it in GitHub Desktop.
bingo.js
const Raspi = require('raspi-io');
const five = require('johnny-five');
const board = new five.Board({
io: new Raspi()
});
board.on('ready', () => {
var button = new five.Led('P1-7');
// Create an Led on pin 7 (GPIO4) on P1 and strobe it on/off
// Optionally set the speed; defaults to 100ms
//(new five.Led('P1-7')).strobe();
button.on("down", function() {
console.log("down");
});
// "hold" the button is pressed for specified time.
// defaults to 500ms (1/2 second)
// set
button.on("hold", function() {
console.log("hold");
});
// "up" the button is released
button.on("up", function() {
console.log("up");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment