-
-
Save Dicetog/44f04845828edbee9740 to your computer and use it in GitHub Desktop.
Bone101 Tutorial
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
<h1 style="font-size: 2em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); line-height: normal;">analogRead(pin, [callback])</h1><p style="font-size: 1.1em; line-height: 1.3em; color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif;">Read the voltage at an analog input pin.</p><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; line-height: normal;">Arguments</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><li><em>pin</em>: the <a href="http://beagleboard.org/Support/BoneScript/#pin" style="color: rgb(222, 114, 36);">pin identifier</a></li><li><em>callback</em>: called upon completion</li></ul><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; line-height: normal;">Return value</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><li>Number from 0 to 1 where 0 is 0V and 1 is the maximum input voltage (1.8V)</li></ul><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; line-height: normal;">callback(x)</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><li><em>x.value</em>: return value</li><li><em>x.err</em>: error status message</li></ul><div><span style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><br></span></div><div><h2 style="font-family: Arial, Verdana, Helvetica, sans-serif; line-height: normal; color: rgb(180, 162, 121); margin: 5px 0px; font-size: 1.5em;">Build and execute instructions</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><li>Apply voltage between 0V and 1.8V to P9_36 and run the example code that will be on the next card.</li><li>Adjust the voltage between 0V and 1.8V to P9_36 and run the example code again.</li><li>Alter the code to look at inputs on other analog input pins.</li></ul></div> |
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 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; line-height: normal;">Build and execute instructions</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><li>Apply voltage between 0V and 1.8V to P9_36 and run the example code that will be on the next card.</li><li>Adjust the voltage between 0V and 1.8V to P9_36 and run the example code again.</li><li>Alter the code to look at inputs on other analog input pins.</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'); | |
b.analogRead('P9_36', printStatus); | |
function printStatus(x) { | |
console.log('x.value = ' + x.value); | |
console.log('x.err = ' + x.err); | |
} |
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
<div id="content_child" style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px;">See also</h2><h3 style="font-size: 1.2em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; font-weight: normal;">Topics</h3><ul><li><a href="http://beagleboard.org/Support/bone101/#headers" style="color: rgb(222, 114, 36);">BeagleBone expansion headers</a></li><li><a href="http://beagleboard.org/Support/BoneScript/#analogio" style="color: rgb(222, 114, 36);">Analog I/O</a></li></ul><h3 style="font-size: 1.2em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; font-weight: normal;">Related functions</h3><ul><li><a href="http://beagleboard.org/Support/BoneScript/#require" style="color: rgb(222, 114, 36);">require</a></li><li><a href="http://beagleboard.org/Support/BoneScript/analogWrite/" style="color: rgb(222, 114, 36);">analogWrite</a></li></ul><h3 style="font-size: 1.2em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); margin: 5px 0px; font-weight: normal;">Examples</h3><ul><li><a href="http://beagleboard.org/Support/BoneScript/cape_bacon/" style="color: rgb(222, 114, 36);">Bacon Cape</a></li></ul><div><br></div><div>This tutorial was made by Diego Turcios.</div><div><br></div> |
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
<span style="font-weight: bold;">Function analogRead(pin,[callback])</span><br><br>A small explanation on how to use the analogRead function of the bonescript library.<br><img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQN7x9gq1QM3zGiUYl__PIrvaMNPXJrKUD9DGAc81eoedxTG5EVsjtSLxw" style="width: 123px;"><br> |
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
Preview Card 1 | |
Arguments | |
Build and execute instructions | |
Example Code | |
See Also |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment