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.
Dependencies: mbed move4wheel2 EC CruizCore_R1370P
Diff: can/can.cpp
- Revision:
- 5:6cebe1c458a9
- Parent:
- 4:317c53a674fa
- Child:
- 6:26724c287387
--- a/can/can.cpp Fri Mar 01 08:00:53 2019 +0000
+++ b/can/can.cpp Sat Mar 02 07:18:38 2019 +0000
@@ -8,8 +8,8 @@
CAN can1(p30,p29,1000000);
Ticker can_ticker; //can用ticker
-DigitalOut canread_led(LED1); //canread -> on
-DigitalOut cansend_led(LED2); //cansend -> on
+DigitalOut cansend_led(LED1); //canread -> on
+DigitalOut canread_led(LED2); //cansend -> on
void can_readsend()
{
@@ -32,22 +32,16 @@
if(msg.id == 3) {
usw_data1 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
- //debug_printf("usw_data1 = %f\n\r",usw_data1);
- }
+ debug_printf("usw_data1 = %f\n\r",usw_data1);
- if(msg.id == 4){
- usw_data2 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
- //debug_printf("usw_data2 = %f\n\r",usw_data2);
- }
+ usw_data2 = 0.1 * (short)((msg.data[2]<<8) | msg.data[3]);
+ debug_printf("usw_data2 = %f\n\r",usw_data2);
- if(msg.id == 5){
- usw_data3 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
- //debug_printf("usw_data3 = %f\n\r",usw_data3);
- }
+ usw_data3 = 0.1 * (short)((msg.data[4]<<8) | msg.data[5]);
+ debug_printf("usw_data3 = %f\n\r",usw_data3);
- if(msg.id == 6) {
- usw_data4 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]);
- //debug_printf("usw_data4 = %f\n\r",usw_data4);
+ usw_data4 = 0.1 * (short)((msg.data[6]<<8) | msg.data[7]);
+ debug_printf("usw_data4 = %f\n\r",usw_data4);
}
} else {