Beagle Board - beagleboard.org

Demo: Blink an on-board LED

Code

var b = require('bonescript');
var led = "USR3";
var state = 0;

b.pinMode(led, 'out');
toggleLED = function() {
    state = state ? 0 : 1;
    b.digitalWrite(led, state);
};

timer = setInterval(toggleLED, 100);

stopTimer = function() {
    clearInterval(timer);
};

setTimeout(stopTimer, 3000);

Build and execute instructions

  • Run the example code and observe USR3 blinking.
  • Alter the frequency and re-run the example.

See also

Topics

Related functions

Examples

See it in action


Last updated by jessica.lynne.callaway on Thu Dec 05 2013 15:38:02 GMT-0000 (UTC).
44412