Created
June 11, 2017 12:33
-
-
Save ruanyf/90262fcd504e4d7edc747ce554e7f355 to your computer and use it in GitHub Desktop.
Blinking LED on Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rpio = require('rpio'); | |
rpio.open(11, rpio.OUTPUT); | |
/* | |
* Blink the LED quickly (10 times per second). It is switched on every | |
* 100ms, and a timeout is set for 50ms later to switch it off, giving us | |
* the regular blink. | |
*/ | |
setInterval(function blink() { | |
rpio.write(11, rpio.HIGH); | |
setTimeout(function ledoff() { | |
rpio.write(11, rpio.LOW); | |
}, 50); | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment