Skip to content

Instantly share code, notes, and snippets.

@Dicetog
Created August 6, 2014 08:40
Show Gist options
  • Save Dicetog/72121bca8c804650bc16 to your computer and use it in GitHub Desktop.
Save Dicetog/72121bca8c804650bc16 to your computer and use it in GitHub Desktop.
Bone101 Tutorial
<h1 style="font-size: 2em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); line-height: normal;">getPinMode(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;">Get the mode of a 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&nbsp;<a href="http://beagleboard.org/Support/BoneScript/getPinMode/bonescript#pin" style="color: rgb(222, 114, 36);">BeagleBone pin</a>&nbsp;identifier</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><em>mux</em>: index of mux mode</li><li><em>options</em>: array of mode names</li><li><em>slew</em>: 'fast' or 'slow'</li><li><em>rx</em>: 'enabled' or 'disabled'</li><li><em>pullup</em>: 'diabled', 'pullup' or 'pulldown'</li><li><em>pin</em>: key string for pin</li><li><em>name</em>: pin name</li><li><em>err</em>: error status message</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</em>: return value</li></ul>
var b = require('bonescript');
b.getPinMode("P8_13", printPinMux);
function printPinMux(x) {
console.log('mux = ' + x.mux);
console.log('pullup = ' + x.pullup);
console.log('slew = ' + x.slew);
if(x.options)
console.log('options = ' +
x.options.join(','));
console.log('pin = ' + x.pin);
console.log('name = ' + x.name);
console.log('err = ' + x.err);
}
<span style="font-weight: bold;">
getPinMode(pin, [callback])
</span>
<p>
A small explanation of the getPinMode function.
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ5RIqUaRRNmT801sTv6rf-cwpz9qfzj5w4XEzR2YaUsJajXmRN" style="width: 80px;"><br></p>
Preview Card 1
Explanation
Example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment