16 bit = 2 byte!

Parsing the buffer in JavaScript code:

const val = new Uint16Array(Buffer); // val.length = 10000 (2 channels x 
5000 samples)

// output raw data: integer from 0 (=0V) to 4095 (=1V8)
console.log(val[0], val[1]); //  first samples AIN-1, AIN-2
console.log(val[2], val[3]); // second samples AIN-1, AIN-2
...

// output voltage: foating point from 0.0 V to 1.8 V
const f = 1.8 / 4095;
console.log(f*val[0], f*val[1]); //  first samples AIN-1, AIN-2
console.log(f*val[2], f*val[3]); // second samples AIN-1, AIN-2
...

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/37dbce3e-7e07-4299-be5c-e67ea2250a50n%40googlegroups.com.

Reply via email to