Library for the m3pi robot. This works with a Pololu 3pi robot with the Serial Slave firmware, and exposes and API. Added a read sensors function
Dependents: pololu_mpi3_V2 pololu_mpi3
Fork of m3pi by
REZO
Diff: m3pi.cpp
- Revision:
- 9:b256a26ca39c
- Parent:
- 7:9b128cebb3c2
- Child:
- 10:b84673574e1a
--- a/m3pi.cpp Thu May 12 13:26:37 2011 +0000 +++ b/m3pi.cpp Sun Nov 22 02:05:03 2015 +0000 @@ -195,6 +195,22 @@ } +void m3pi::readsensor (int *sensor){ + + _ser.putc(SEND_CALIBRATED_SENSOR_VALUES); + sensor[0] = _ser.getc(); + sensor[0] += _ser.getc() << 8; + sensor[1] = _ser.getc(); + sensor[1] += _ser.getc() << 8; + sensor[2] = _ser.getc(); + sensor[2] += _ser.getc() << 8; + sensor[3] = _ser.getc(); + sensor[3] += _ser.getc() << 8; + sensor[4] = _ser.getc(); + sensor[4] += _ser.getc() << 8; + + return; +}