2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
58:6b73e683fa70
Parent:
57:3fbd487e055e
--- a/autoMode.h	Tue Sep 29 08:23:03 2015 +0000
+++ b/autoMode.h	Wed Sep 30 12:31:48 2015 +0000
@@ -24,12 +24,18 @@
         wait(0.1);
         stateR = defoR;
         stateL = defoL;
+        step=0;
+        CStep=1;
     }
-    else if(b==5){ /*reset*/
-        sendData(4,31);
+    else if(b==5){ /*middle pole start*/
+        targ_velocity=speed;
+        sendData(4,defoR);
         wait(0.1);
-        sendData(5,31);
+        sendData(5,defoL);
         wait(0.1);
+        stateR = defoR;
+        stateL = defoL;
+        step=4;
     }
     else if(b==8){ /*set defo*/
         sendData(5,defoR);
@@ -38,6 +44,10 @@
         wait(0.1);
     }
     else if(b==9){  /*stop*/
+        sendData(5,31);
+        wait(0.1);
+        sendData(4,31);
+        wait(0.1);
         Motor_swing=0;
         sita=PI/4.0,x=0.0,y=0.0;
         targ_velocity=0.0;
@@ -97,6 +107,19 @@
         wait(0.1);
         stateR = defoR;
         stateL = defoL;
+        step=0;
+        CStep=1;
+    }
+    else if(left) { /*middle start*/
+        targ_velocity=speed;
+        sendData(4,15);
+        wait(0.1);
+        sendData(5,15);
+        wait(0.1);
+        stateR = defoR;
+        stateL = defoL;
+        step=4;
+        CStep=6;
     }
     else if(square){ /*reset*/
         sendData(4,31);
@@ -104,13 +127,17 @@
         sendData(5,31);
         wait(0.1);
     }
-    else if(triangle){ /*set defo*/
+    /*else if(triangle){ 
         sendData(5,defoL);
         wait(0.1);
         sendData(4,defoR);
         wait(0.1);
-    }
+    }*/
     else if(cross){  /*stop*/
+        sendData(5,31);
+        wait(0.1);
+        sendData(4,31);
+        wait(0.1);
         Motor_swing=0;
         sita=PI/4.0,x=0.0,y=0.0;
         targ_velocity=0.0;