1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <?xml-stylesheet type="text/xsl" href="helma.xsl"?>
3 <xmlroot xmlns:hop="http://www.helma.org/docs/guide/features/database">
4 <hopobject id="2806" name="demo_blinkled_external" prototype="Page" created="1372219442081" lastModified="1387490194895">
5 <hop:parent idref="2471" prototyperef="Page"/>
6 <is_xhtml type="boolean">true</is_xhtml>
7 <http_remotehost>192.91.75.29</http_remotehost>
8 <http_language>en-US,en;q=0.8,fr;q=0.6</http_language>
9 <uri>demo_blinkled_external</uri>
10 <http_browser>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36</http_browser>
11 <time type="date">19.12.2013 15:56:34 CST</time>
12 <hopsession>192.91.75.yfl0dmkzwh07</hopsession>
13 <body><script src="/static/bonescript-demo.js"></script>
\r
14 <div id='side-menu' class="t3_sidebar">
\r
15 <ul class="left-menu">
\r
16 <strong>Navigation</strong>
\r
17 <li><a href="/Support/BoneScript/menu/">Menu contents</a></li>
\r
20 <div class="t3_content_1">
\r
21 <div id='connect-status'></div>
\r
22 <div id="content_child">
\r
24 <h1>Demo: Blink an external LED</h1>
\r
26 <button class="dynlink" onclick="demoRun('code')">run</button>
\r
27 <button class="dynlink" onclick="demoRestore('code')">restore</button>
\r
29 <pre id='code' class='use-editor' style='height:280px;'>
\r
30 var b = require('bonescript');
\r
31 var led = "P8_13";
\r
34 b.pinMode(led, 'out');
\r
35 toggleLED = function() {
\r
36 state = state ? 0 : 1;
\r
37 b.digitalWrite(led, state);
\r
40 timer = setInterval(toggleLED, 100);
\r
42 stopTimer = function() {
\r
43 clearInterval(timer);
\r
46 setTimeout(stopTimer, 30000);</pre>
\r
47 <div readonly id='console-output' style='height:80px;'></div>
\r
48 <h2>Build and execute instructions</h2>
\r
49 <img align="right" width="50%" src="http://beagleboard.org/static/uploads/Demo%20Blinked.PNG" />
\r
51 <li>Connect an LED and resistor as shown being sure to get the anode/cathode orientation correct.</li>
\r
52 <li>Run the example code and observe the blinking.</li>
\r
53 <li>Alter the frequency and re-run the example.</li>
\r
55 <h2>See also</h2>
\r
56 <h3>Topics</h3>
\r
58 <li><a href="/Support/BoneScript/#headers">BeagleBone expansion headers</a></li>
\r
59 <li><a href="/Support/BoneScript/#digitalio">Digital I/O</a></li>
\r
60 <li><a href="/Support/BoneScript/#timers">Timers</a></li>
\r
62 <h3>Related functions</h3>
\r
64 <li><a href="/Support/BoneScript/#require">require</a></li>
\r
65 <li><a href="/Support/BoneScript/pinMode">pinMode</a></li>
\r
66 <li><a href="/Support/BoneScript/digitalWrite">digitalWrite</a></li>
\r
68 <h3>Examples</h3>
\r
70 <li><a href="/Support/BoneScript/demo_blinkled">Blink an on-board LED</a></li>
\r
73 <h3>Where to buy</h3>
\r
75 <li><a href="http://elinux.org/CircuitCo:BeagleBone_Breadboard#Distributors">BreadBoard</a></li>
\r
76 <li><a href="https://www.sparkfun.com/products/9590">External LED</a></li>
\r
77 <li><a href="https://www.sparkfun.com/products/11026">Jumper wires</a></li>
\r
78 <li><a href="https://www.sparkfun.com/search/products?sort_by=relevance%7Casc&per_page=500&term=resistor">Resistors</a></li>
\r
82 <div style="clear:both; padding-left: 213px;"><h2>See it in action</h2>
\r
83 <iframe width="560" height="315" src="//www.youtube.com/embed/kmctGc_JALc" frameborder="0" allowfullscreen></iframe></div>
\r
85 <pseudoparent idref="2471" prototyperef="Page"/>
86 <http_referer>http://beagleboard.org/support/BoneScript/demo_blinkled_external/edit</http_referer>
87 <http_host>beagleboard.org</http_host>
88 <user>jessica.lynne.callaway@gmail.com</user>