Created
August 11, 2015 23:04
-
-
Save ebadawy/20aee5d25c75b7b30a07 to your computer and use it in GitHub Desktop.
Blinking onboard LED
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
default |
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
<h2>Build and execute instructions</h2> | |
<img align="right" src="/static/images/black-usr3-led.PNG"> | |
<ul> | |
<li>Run the example code and observe USR3 blinking.</li> | |
<li>Alter the frequency and re-run the example.</li> | |
</ul> | |
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 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); |
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
<h2>See also</h2> | |
<h3>Topics</h3> | |
<ul> | |
<li><a href="/Support/BoneScript/#headers">BeagleBone expansion headers</a></li> | |
<li><a href="/Support/BoneScript/#digitalio">Digital I/O</a></li> | |
<li><a href="/Support/BoneScript/#timers">Timers</a></li> | |
</ul> | |
<h3>Related functions</h3> | |
<ul> | |
<li><a href="/Support/BoneScript/#require">require</a></li> | |
<li><a href="/Support/BoneScript/pinMode">pinMode</a></li> | |
<li><a href="/Support/BoneScript/digitalWrite">digitalWrite</a></li> | |
</ul> | |
<h3>Examples</h3> | |
<ul> | |
<li><a href="/Support/BoneScript/demo_blinkled_external">Blink an external LED</a></li> | |
</ul> | |
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
{"title":"Blink an LED","description":"Blinking onboard LED","bonecards":[{"title":"Build And Execute","type":"html"},{"title":"Demo","type":"code"},{"title":"See Also","type":"html"}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment