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="2564" name="digitalWrite" prototype="Page" created="1367625922704" lastModified="1372364764429">
5 <hop:parent idref="2471" prototyperef="Page"/>
6 <is_xhtml type="boolean">true</is_xhtml>
7 <http_remotehost>127.0.0.1</http_remotehost>
8 <http_language>en-US,en;q=0.8</http_language>
9 <uri>digitalWrite</uri>
10 <http_browser>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36</http_browser>
11 <time type="date">27.06.2013 15:26:04 CDT</time>
12 <hopsession>127.0.0.192.91.66.1d0e984u3g7ia</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"><strong>Navigation</strong>
\r
16 <li><a href="/static/side-menu.html">Menu contents</a></li>
\r
19 <div class="t3_content_1"><div id='connect-status'></div><div id="content_child">
\r
20 <h1>digitalWrite(pin, value, [callback])</h1>
\r
21 <p>Write a <a href="/Support/BoneScript/#HIGH">HIGH</a> or <a href="../#LOW">LOW</a> to a digital I/O pin.</p>
\r
22 <p>NOTE: The 4 USRx LEDs are all able to operate as digital output pins, giving you an always-available
\r
23 output to test your software.</p>
\r
24 <h2>Arguments</h2>
\r
26 <li><em>pin</em>: the <a href="/Support/BoneScript/#pin">BeagleBone pin</a> identifier</li>
\r
27 <li><em>value</em>: the logic level to set the pin</li>
\r
28 <li><em>callback</em>: called upon completion</li>
\r
30 <h2>Return value</h2>
\r
32 <li><a href="/Support/BoneScript/#true">true</a> if successful</li>
\r
33 <li><a href="/Support/BoneScript/#false">false</a> on failure</li>
\r
35 <h2>callback(x)</h2>
\r
37 <li><em>x.err</em>: error status message</li>
\r
40 <button class="dynlink" onclick="demoRun('code')">run</button>
\r
41 <button class="dynlink" onclick="demoRestore('code')">restore</button>
\r
43 <pre id="code" class="use-editor" style="height:60px;">
\r
44 var b = require('bonescript');
\r
45 b.pinMode('USR0', b.OUTPUT);
\r
46 b.digitalWrite('USR0', b.HIGH);</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/LEDs.PNG" />
\r
51 <li>The USR0 LED is built in, so no circuit assembly is required.</li>
\r
52 <li>Look for it to go high when you run the example code.</li>
\r
53 <li>Alter the code to set it low and run it again.</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
61 <h3>Related functions</h3>
\r
63 <li><a href="/Support/BoneScript/#require">require</a></li>
\r
64 <li><a href="/Support/BoneScript/pinMode">pinMode</a></li>
\r
66 <h3>Examples</h3>
\r
68 <li><a href="/Support/BoneScript/demo_blinkled">Blink an on-board LED</a></li>
\r
69 <li><a href="/Support/BoneScript/demo_blinkled_external">Blink an external LED</a></li>
\r
71 </div></div><div style="clear: both;"></div></body>
72 <pseudoparent idref="2471" prototyperef="Page"/>
73 <http_referer>http://beagleboard.org/support/BoneScript/digitalWrite/edit</http_referer>
74 <http_host>beagleboard.org</http_host>
75 <user>cortezjuanjr@gmail.com</user>