Standard m3pi with one extra method.
Fork of m3pi by
Diff: m3pi.cpp
- Revision:
- 9:d2449eb32198
- Parent:
- 7:9b128cebb3c2
--- a/m3pi.cpp Fri Mar 25 15:44:52 2011 +0000 +++ b/m3pi.cpp Wed May 09 15:35:12 2018 +0000 @@ -112,6 +112,24 @@ return(fpos); } +void m3pi::get_raw_values(unsigned int *values) +{ + while (_ser.readable() ) { // flush buffer + _ser.getc(); + } + + char vals[10]; // array to receive 10 byte return message + _ser.putc(0x86); // send command + + for (int i=0; i < 10; i++) { + vals[i] = _ser.getc(); + } + + for(int i=0; i<5; i++) { // construct the 2-byte values + values[i] = (vals[2*i+1] << 8) | vals[2*i]; + } +} + char m3pi::sensor_auto_calibrate() { _ser.putc(AUTO_CALIBRATE); return(_ser.getc());