Web edits
[beagleboard.org.git] / db / 2768.xml
blob05c26285010be936b73047a02ffbe0deff7384b2
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="2768" name="analogRead" prototype="Page" created="1371676191534" lastModified="1371676290452">
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>analogRead</uri>
10     <http_browser>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36</http_browser>
11     <time type="date">19.06.2013 16:11:30 CDT</time>
12     <hopsession>127.0.0.192.91.66.1u05jlh65hfie</hopsession>
13     <body>&lt;script src=&quot;/static/bonescript-demo.js&quot;&gt;&lt;/script&gt;\r
14 &lt;div id=&apos;side-menu&apos; class=&quot;t3_sidebar&quot;&gt;\r
15     &lt;ul class=&quot;left-menu&quot;&gt;&lt;strong&gt;Navigation&lt;/strong&gt;\r
16         &lt;li&gt;&lt;a href=&quot;/static/side-menu.html&quot;&gt;Menu contents&lt;/a&gt;&lt;/li&gt;\r
17     &lt;/ul&gt;\r
18 &lt;/div&gt;\r
19 &lt;div class=&quot;t3_content_1&quot;&gt;&lt;div id=&apos;connect-status&apos;&gt;&lt;/div&gt;&lt;div id=&quot;content_child&quot;&gt;\r
20 &lt;!--- START CONTENT --&gt;\r
22 &lt;h1&gt;analogRead(pin, [callback])&lt;/h1&gt;\r
23 &lt;p&gt;Read the voltage at an analog input pin.&lt;/p&gt;\r
24 &lt;h2&gt;Arguments&lt;/h2&gt;\r
25 &lt;ul&gt;\r
26  &lt;li&gt;&lt;em&gt;pin&lt;/em&gt;: the &lt;a href=&quot;/Support/BoneScript/#pin&quot;&gt;pin identifier&lt;/a&gt;&lt;/li&gt;\r
27  &lt;li&gt;&lt;em&gt;callback&lt;/em&gt;: called upon completion&lt;/li&gt;\r
28 &lt;/ul&gt;\r
29 &lt;h2&gt;Return value&lt;/h2&gt;\r
30 &lt;ul&gt;\r
31  &lt;li&gt;Number from 0 to 1 where 0 is 0V and 1 is the maximum input voltage (1.8V)&lt;/li&gt;\r
32 &lt;/ul&gt;\r
33 &lt;h2&gt;callback(x)&lt;/h2&gt;\r
34 &lt;ul&gt;\r
35  &lt;li&gt;&lt;em&gt;x.value&lt;/em&gt;: return value&lt;/li&gt;\r
36  &lt;li&gt;&lt;em&gt;x.err&lt;/em&gt;: error status message&lt;/li&gt;\r
37 &lt;/ul&gt;\r
38 &lt;h2&gt;Example\r
39  &lt;button class=&quot;dynlink&quot; onclick=&quot;demoRun(&apos;code&apos;)&quot;&gt;run&lt;/button&gt;\r
40  &lt;button class=&quot;dynlink&quot; onclick=&quot;demoRestore(&apos;code&apos;)&quot;&gt;restore&lt;/button&gt;\r
41 &lt;/h2&gt;\r
42 &lt;pre id=&quot;code&quot; class=&quot;use-editor&quot; style=&quot;height: 120px;&quot;&gt;\r
43 var b = require(&apos;bonescript&apos;);\r
44 b.analogRead(&apos;P9_36&apos;, printStatus);\r
45 function printStatus(x) {\r
46     console.log(&apos;x.value = &apos; + x.value);\r
47     console.log(&apos;x.err = &apos; + x.err);\r
48 }&lt;/pre&gt;\r
49 &lt;div readonly id=&apos;console-output&apos; style=&apos;height: 80px;&apos;&gt;&lt;/div&gt;\r
50 &lt;h2&gt;Build and execute instructions&lt;/h2&gt;\r
51 &lt;ul&gt;\r
52  &lt;li&gt;Apply voltage between 0V and 1.8V to P9_36 and run the example code.&lt;/li&gt;\r
53  &lt;li&gt;Adjust the voltage between 0V and 1.8V to P9_36 and run the example code again.&lt;/li&gt;\r
54  &lt;li&gt;Alter the code to look at inputs on other analog input pins.&lt;/li&gt;\r
55 &lt;/ul&gt;\r
56 &lt;h2&gt;See also&lt;/h2&gt;\r
57 &lt;h3&gt;Topics&lt;/h3&gt;\r
58 &lt;ul&gt;\r
59  &lt;li&gt;&lt;a href=&quot;/Support/bone101/#headers&quot;&gt;BeagleBone expansion headers&lt;/a&gt;&lt;/li&gt;\r
60  &lt;li&gt;&lt;a href=&quot;/Support/BoneScript/#analogio&quot;&gt;Analog I/O&lt;/a&gt;&lt;/li&gt;\r
61 &lt;/ul&gt;\r
62 &lt;h3&gt;Related functions&lt;/h3&gt;\r
63 &lt;ul&gt;\r
64  &lt;li&gt;&lt;a href=&quot;/Support/BoneScript/#require&quot;&gt;require&lt;/a&gt;&lt;/li&gt;\r
65  &lt;li&gt;&lt;a href=&quot;/Support/BoneScript/analogWrite/&quot;&gt;analogWrite&lt;/a&gt;&lt;/li&gt;\r
66 &lt;/ul&gt;\r
67 &lt;h3&gt;Examples&lt;/h3&gt;\r
68 &lt;ul&gt;\r
69  &lt;li&gt;&lt;a href=&quot;/Support/BoneScript/cape_bacon/&quot;&gt;Bacon Cape&lt;/a&gt;&lt;/li&gt;\r
70 &lt;/ul&gt;</body>
71     <pseudoparent idref="2471" prototyperef="Page"/>
72     <http_referer>http://beagleboard.org/support/BoneScript/analogRead/edit</http_referer>
73     <http_host>beagleboard.org</http_host>
74     <lang>en-us</lang>
75     <user>rachelballdesign@gmail.com</user>
76   </hopobject>
77 </xmlroot>