Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Use bonescript and node.js to read from all analog pins on a BeagleBone
/*
* analog-read-all.js
* Use bonescript and node.js to read from all analog pins on a BeagleBone
* Found in the wild:
* https://groups.google.com/forum/#!msg/beagleboard/rftH6aqyR5k/n7jQbCNAL3YJ
*/
var bb = require('./bonescript');
var sys = require('util');
var fs = require('fs');
// default path
ADCPATH = "/sys/bus/platform/devices/tsc/ain";
analogRead = function(pin) {
return fs.readFileSync(ADCPATH + (pin+1));
};
setup = function() {
};
loop = function() {
var i;
for( i = 0; i < 8; i++){
sys.puts("adc" + i + " := " + analogRead(i));
}
delay(1000);
};
bb.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.