johnny-five-electron
Version:
Temporary fork to support Electron (to be deprecated)
28 lines (21 loc) • 594 B
JavaScript
var five = require("../lib/johnny-five");
var board = new five.Board();
// This works with the 74HC595 that comes with the SparkFun Inventor's kit.
// Your mileage may vary with other chips. For more information on working
// with shift registers, see http://arduino.cc/en/Tutorial/ShiftOut
board.on("ready", function() {
var register = new five.ShiftRegister({
pins: {
data: 2,
clock: 3,
latch: 4
}
});
var value = 0;
function next() {
value = value > 0x11 ? value >> 1 : 0x88;
register.send(value);
setTimeout(next, 200);
}
next();
});