johnny-five
Version:
Firmata based Arduino Programming Framework.
32 lines (22 loc) • 597 B
JavaScript
var five = require("../lib/johnny-five.js"),
board;
board = new five.Board();
// The board's pins will not be accessible until
// the board has reported that it is ready
board.on("ready", function() {
var val = 0;
// Set pin 13 to OUTPUT mode
this.pinMode( 13, 1 );
// Mode Table
// INPUT: 0
// OUTPUT: 1
// ANALOG: 2
// PWM: 3
// SERVO: 4
// Create a loop to "flash/blink/strobe" an led
this.loop( 50, function() {
this.digitalWrite( 13, (val = val ? 0 : 1) );
});
});
// Schematic
// http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png