beagleboard.org

Bonescript

You might be able to see a newer version of this on beagleboard.org/support/bonescript/demo_blinkled

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