asdasd
Fork of m3pi by
Revision 9:ede0b90cc2b8, committed 2015-07-05
- Comitter:
- scarcyon
- Date:
- Sun Jul 05 09:42:31 2015 +0000
- Parent:
- 8:4b7d6ea9b35b
- Commit message:
- a
Changed in this revision
m3pi.cpp | Show annotated file Show diff for this revision Revisions of this file |
m3pi.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4b7d6ea9b35b -r ede0b90cc2b8 m3pi.cpp --- a/m3pi.cpp Thu May 12 13:26:37 2011 +0000 +++ b/m3pi.cpp Sun Jul 05 09:42:31 2015 +0000 @@ -24,6 +24,8 @@ #include "mbed.h" #include "m3pi.h" +#define SEND_CALIBRATED_SENSOR_VALUES 0x87 + m3pi::m3pi(PinName nrst, PinName tx, PinName rx) : Stream("m3pi"), _nrst(nrst), _ser(tx, rx) { _ser.baud(115200); reset(); @@ -194,6 +196,23 @@ return(_ser.getc()); } +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; +} +
diff -r 4b7d6ea9b35b -r ede0b90cc2b8 m3pi.h --- a/m3pi.h Thu May 12 13:26:37 2011 +0000 +++ b/m3pi.h Sun Jul 05 09:42:31 2015 +0000 @@ -216,6 +216,9 @@ * @param text A pointer to a char array * @param int The character to send to the 3pi */ + + void readsensor (int *sensor); + int print(char* text, int length); #ifdef MBED_RPC