Beagle Board - beagleboard.org

analogRead(pin, [callback])

Read the voltage at an analog input pin.

Arguments

Return value

  • Number from 0 to 1 where 0 is 0V and 1 is the maximum input voltage (1.8V)

callback(x)

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

Example

var b = require('bonescript');
b.analogRead('P9_36', printStatus);
function printStatus(x) {
    console.log('x.value = ' + x.value);
    console.log('x.err = ' + x.err);
}

Build and execute instructions

  • Apply voltage between 0V and 1.8V to P9_36 and run the example code.
  • Adjust the voltage between 0V and 1.8V to P9_36 and run the example code again.
  • Alter the code to look at inputs on other analog input pins.

See also

Topics

Related functions

Examples


Last updated by rachelballdesign on Wed Jun 19 2013 21:11:30 GMT-0000 (UTC).
32030