johnny-five
Version:
The JavaScript Robotics and Hardware Programming Framework. Use with: Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, Raspberry Pi, Spark Core, TI Launchpad and more!
15 lines (12 loc) • 381 B
JavaScript
var five = require("../lib/johnny-five.js");
new five.Board().on("ready", function() {
// Attaching to an O* pin in a deviation from
// TinkerKit tutorials which instruct to attach
// the button to an I* pin.
var button = new five.Button("O5");
["down", "up", "hold"].forEach(function(type) {
button.on(type, function() {
console.log(type);
});
});
});