Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: m3pi.cpp
- Revision:
- 6:39daa09102a0
- Parent:
- 5:847e6cbd458b
- Child:
- 7:b4fc73882a2a
diff -r 847e6cbd458b -r 39daa09102a0 m3pi.cpp
--- a/m3pi.cpp Thu Jun 29 09:25:07 2017 +0000
+++ b/m3pi.cpp Wed Jul 05 10:05:46 2017 +0000
@@ -62,29 +62,31 @@
char vals[10]; // array to receive 10 byte return message
_serial->putc(0x87); // send command
+
while (_serial->readable() == 0) {
}
-
for (int i=0; i < 10; i++) {
vals[i] = _serial->getc();
}
+
+ /*
+ int n=0;
+ while ( _serial->readable() ) { // keep looping while data on rx line
+ vals[n] = _serial->getc(); // read into array
+ n++; // increment index
+ }
+ */
+
for(int i=0; i<5; i++) { // construct the 2-byte values
values[i] = (vals[2*i+1] << 8) | vals[2*i];
}
- //int n=0;
- //while ( _serial->readable() ) { // keep looping while data on rx line
- // vals[n] = _serial->getc(); // read into array
- // n++; // increment index
- //}
+
- //for(int i=0; i<5; i++) { // construct the 2-byte values
- // values[i] = (vals[2*i+1] << 8) | vals[2*i];
- //}
+
- //wait_ms(1);
}
float m3pi::get_trimpot_value()