
Using CAN bus with (not just NUCLEO) mbed boards support Cortex-M0
Fork of CAN_Hello by
Revision 3:36b034f320b6, committed 2018-03-22
- Comitter:
- szqt
- Date:
- Thu Mar 22 13:41:08 2018 +0000
- Parent:
- 2:6546e4a2d593
- Commit message:
- Support NUCLEO-F091RC (Cortex-M0)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6546e4a2d593 -r 36b034f320b6 main.cpp --- a/main.cpp Wed Oct 11 16:29:04 2017 +0000 +++ b/main.cpp Thu Mar 22 13:41:08 2018 +0000 @@ -98,7 +98,7 @@ voltage = (analogIn * 3.3f) / 4096.0f; // read the small drifting voltage from analog input txMsg.clear(); // clear Tx message storage txMsg.id = TX_ID; // set ID - txMsg << counter << voltage;// append data (total data length must be <= 8 bytes!) + txMsg << voltage << counter;// append data (total data length must be <= 8 bytes!) if(can.write(txMsg)) { // transmit message led = OFF; // turn the LED off pc.printf("-------------------------------------\r\n"); @@ -119,7 +119,7 @@ // Filtering performed by software: if(rxMsg.id == RX_ID) { - rxMsg >> counter >> voltage; // extract data from the received CAN message + rxMsg >> voltage >> counter; // extract data from the received CAN message pc.printf(" counter = %d\r\n", counter); pc.printf(" voltage = %e V\r\n", voltage); timer.start(); // transmission lag