can出来ない~
Dependencies: mbed move4wheel2 EC CruizCore_R1370P
Revision 10:6d60c0927770, committed 2019-03-06
- Comitter:
- yuki0701
- Date:
- Wed Mar 06 06:19:53 2019 +0000
- Parent:
- 9:337fe0747940
- Commit message:
- a
Changed in this revision
can/can.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/can/can.cpp Wed Mar 06 03:51:08 2019 +0000 +++ b/can/can.cpp Wed Mar 06 06:19:53 2019 +0000 @@ -16,9 +16,11 @@ void can_readsend() { can_ashileddata[1] = T1; //動作番号(id節約のため、can_ashileddata[]と一緒に送る) - //printf("t1[0] = %d\n\r",t1[0]); + //printf("t1[0] = %d\n\r",can_ashileddata[1]); CANMessage msg; + CANMessage msg2; + CANMessage msg3; if(can1.write(CANMessage(4,can_ashileddata,2))) { //IDを7にして送信 cansend_led = 1; @@ -41,27 +43,24 @@ //debug_printf("[0]=%d [1]=%d [2]=%d [3]=%d [4]=%d [5]=%d [6]=%d\n\r" // ,id1_value[0],id1_value[1],id1_value[2],id1_value[3],id1_value[4],id1_value[5],id1_value[6]); + + t1_r = msg.data[3]; } if(msg.id == 3) { - usw_data1 = 0.1 * (short)((msg.data[0]<<8) | msg.data[1]); + usw_data1 = 0.1 * (short)((msg2.data[0]<<8) | msg2.data[1]); //debug_printf("usw_data1 = %f\n\r",usw_data1); - usw_data2 = 0.1 * (short)((msg.data[2]<<8) | msg.data[3]); + usw_data2 = 0.1 * (short)((msg2.data[2]<<8) | msg2.data[3]); //debug_printf("usw_data2 = %f\n\r",usw_data2); - usw_data3 = 0.1 * (short)((msg.data[4]<<8) | msg.data[5]); + usw_data3 = 0.1 * (short)((msg2.data[4]<<8) | msg2.data[5]); //debug_printf("usw_data3 = %f\n\r",usw_data3); - usw_data4 = 0.1 * (short)((msg.data[6]<<8) | msg.data[7]); + usw_data4 = 0.1 * (short)((msg2.data[6]<<8) | msg2.data[7]); // debug_printf("usw_data4 = %f\n\r",usw_data4); } - if(msg.id == 1) { - t1_r = msg.data[3]; - //printf("t1_r = %d\n\r",t1_r); - } - } else { canread_led = 0; }
--- a/main.cpp Wed Mar 06 03:51:08 2019 +0000 +++ b/main.cpp Wed Mar 06 06:19:53 2019 +0000 @@ -46,6 +46,7 @@ //スタート位置からみかんの木まで移動 printf("T1 = 0\n\r"); + wait(0.5); T1++; //printf("t = %d\n\r",T1); } @@ -54,7 +55,7 @@ while(1) { printf("T1 = 1\n\r"); wait(0.5); - if(T1 == 2) { + if(T1 > 1) { break; } } @@ -70,7 +71,8 @@ if(T1 == 3) { while(1) { printf("T1 = 3\n\r"); - if(T1 == 4) { + wait(0.5); + if(T1 > 3) { break; } @@ -80,13 +82,16 @@ if(T1 == 4) { //三宝置き場からりんごの木まで移動 - printf("t = 4"); + printf("T1 = 4\n\r"); + wait(0.5); T1++; } if(T1 == 5) { while(1) { - if(T1 == 6) { + printf("T1 = 5\n\r"); + wait(0.5); + if(T1 > 5) { break; } } @@ -95,7 +100,8 @@ if(T1 == 6) { //りんごの木からお供え台まで移動 - printf("t = 6"); + printf("T1 = 6\n\r"); + wait(0.5); T1++; } #endif