3/19 23:30
Dependencies: mbed move4wheel2 EC CruizCore_R1370P
Diff: can/can.cpp
- Revision:
- 2:7cba05e70367
- Parent:
- 1:3c11e07da92a
- Child:
- 3:8a0faa3b08c3
--- a/can/can.cpp Mon Feb 25 06:18:09 2019 +0000 +++ b/can/can.cpp Tue Feb 26 05:10:27 2019 +0000 @@ -5,7 +5,7 @@ #include "manual.h" #include "can.h" -CAN can1(p30,p29/*,1000000*/); +CAN can1(p30,p29,1000000); Ticker can_ticker; //can用ticker DigitalOut canread_led(LED1); //canread -> on @@ -32,24 +32,22 @@ if(msg.id == 3){ usw_data1 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]); - //printf("usw_data1 = %d:%d,%lf\n\r",msg.data[0],msg.data[1],usw_data1); - //debug_printf("%f\n\r",usw_data1); + //debug_printf("usw_data1 = %f\n\r",usw_data1); } - /* if(msg.id == 4){ + /*if(msg.id == 4){ usw_data2 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]); - //printf("usw_data2 = %d:%d,%d\n\r",msg.data[0],msg.data[1],usw_data2); + //debug_printf("usw_data2 = %f\n\r",usw_data2); }*/ - if(msg.id == 5){ + /*if(msg.id == 5){ usw_data3 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]); - //printf("usw_data3 = %d:%d,%d\n\r",msg.data[0],msg.data[1],usw_data3); - //debug_printf("%f\n\r",usw_data3); - } + //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]); - //printf("usw_data4 = %d:%d,%d\n\r",msg.data[0],msg.data[1],usw_data4); + //debug_printf("usw_data4 = %f\n\r",usw_data4); }*/ }else{ @@ -69,6 +67,8 @@ CANMessage msg; + debug_printf("wait\n\r"); + wait(0.1); if(can1.read(msg)){ break; }