3/2

Dependencies:   mbed move4wheel2 EC CruizCore_R1370P

Files at this revision

API Documentation at this revision

Comitter:
yuki0701
Date:
Sat Mar 02 07:18:38 2019 +0000
Parent:
4:317c53a674fa
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
diff -r 317c53a674fa -r 6cebe1c458a9 can/can.cpp
--- 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 {
diff -r 317c53a674fa -r 6cebe1c458a9 main.cpp
--- a/main.cpp	Fri Mar 01 08:00:53 2019 +0000
+++ b/main.cpp	Sat Mar 02 07:18:38 2019 +0000
@@ -52,6 +52,7 @@
         
         if(go_waitmode == 0){
            
+           while(1);
            //can_start();
            //set_cond(2,1,-700,1,-700);
            gogo_straight(1,1,-2962,3500,-2962,2900,200,1000,5,0.1,10,0.1,600,0);