Beagle Board - beagleboard.org

BoneScript

digitalRead(pin, [callback])

Read the status of a digital I/O pin.

Arguments

Return value

  • HIGH if pin is HIGH
  • LOW if pin is LOW

callback(x)

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

Example

var b = require('bonescript');
b.pinMode('P8_19', b.INPUT);
b.digitalRead('P8_19', printStatus);
function printStatus(x) {
    console.log('x.value = ' + x.value);
    console.log('x.err = ' + x.err);
}

Build and execute instructions

  • Apply 0V to P8_19 and run the example code.
  • Apply 3.3V to P8_19 and run the example code again.
  • Alter the code to look at inputs on other pins.

See also

Topics

Related functions

Examples


Last updated by blog.hangerhead.com on Fri Jun 21 2013 14:27:12 GMT-0000 (UTC).
1703