Demo: Blink an external LED
Code
var b = require('bonescript');
var led = "P8_13";
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, 30000);
Build and execute instructions
- Connect an LED and resistor as shown being sure to get the anode/cathode orientation correct.
- Run the example code and observe the blinking.
- Alter the frequency and re-run the example.
See also
Topics
Related functions
Examples
Where to buy
See it in action
Last updated by jessica.lynne.callaway on Thu Dec 19 2013 21:56:34 GMT-0000 (UTC).
     





