Fork me on GitHub
beagleboard.org

BoneScript

You might be able to see a newer version of this on beagleboard.org/support/bonescript/pinMode

pinMode(pin, direction, [mux], [pullup], [slew], [callback])

Arguments

  • pin: the BeagleBone pin identifier
  • direction: INPUT, INPUT_PULLUP or OUTPUT
  • mux: index to mux mode (under development on 3.8 kernel)
  • pullup: 'pullup', 'pulldown' or 'disabled' (under development on 3.8 kernel)
  • slew: 'fast' or 'slow' (under development on 3.8 kernel)
  • callback: called upon completion

Return value

callback(x)

  • x.value: return value
  • x.err: error status message

Example

var b = require('bonescript');
b.pinMode("P8_13", b.OUTPUT, 7, 'pullup', 
 'fast', printStatus);
b.getPinMode("P8_13", printPinMux);
function printStatus(x) {
    console.log('value = ' + x.value);
    console.log('err = ' + x.err);
}
function printPinMux(x) {
    console.log('mux = ' + x.mux);
    console.log('pullup = ' + x.pullup);
    console.log('slew = ' + x.slew);
    console.log('options = ' + x.options.join(','));
    console.log('err = ' + x.err);
}

Build and execute instructions

Check out some of the other examples to see and verify pinMode functionality.

See also

Topics

Related functions