Simple bonescript example for reading ADCs

This is not a proper implementation -- the ADCPATH and analogRead()
definitions ought to be in the bonescript/index.js file and the
arguments for analogRead should accept arguments like "bone.P9_33",
but it gives the basic idea ....

var bb = require('./bonescript');
var sys = require('sys');
var fs = require('fs');

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();