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, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!
42 lines (32 loc) • 684 B
JavaScript
var five = require("../lib/johnny-five");
var board = new five.Board();
board.on("ready", function() {
var leda = new five.Led(10);
var ledb = new five.Led(11);
var BAS1 = new five.Button({
controller: "EVS_EV3",
pin: "BAS1"
});
var BBS1 = new five.Button({
controller: "EVS_EV3",
pin: "BBS1"
});
BAS1.on("down", function(value) {
leda.on();
});
BAS1.on("hold", function() {
leda.blink(500);
});
BAS1.on("up", function() {
leda.stop().off();
});
BBS1.on("down", function(value) {
ledb.on();
});
BBS1.on("hold", function() {
ledb.blink(500);
});
BBS1.on("up", function() {
ledb.stop().off();
});
});