Fork de Timer après le match à 61 points

Dependencies:   RoboClaw mbed

Fork of Timer by ARES

Revision:
90:78d2c1527c95
Parent:
89:46730de0d013
Child:
91:65fb6b9f3932
--- a/main.cpp	Fri May 06 11:54:27 2016 +0000
+++ b/main.cpp	Fri May 06 12:34:25 2016 +0000
@@ -19,6 +19,7 @@
 int Ravance = 1;
 DigitalIn start(PB_7);
 AX12 umbrella(PA_9, PA_10, 2, 250000);
+float R_SEUIL_SHARP = 1;
 
 /* Debut du programme */
 int main(void)
@@ -31,22 +32,34 @@
     umbrella.setMaxTorque(200);
     umbrella.setGoal(150);
     wait(1);
-    umbrella.setGoal(200);
+    umbrella.setGoal(160);
     wait(1);
-    umbrella.setGoal(160);
+    umbrella.setGoal(150);
+    wait(1);
+    umbrella.setMaxTorque(0);
     
     depart();
     if (SCouleur == VERT) {
-        end.attach(&endFonc, 90);
-        GotoDist(8);
-        GotoArr(8.2);
+        end.attach(&endFonc, 60);
+        GotoDist(9.0);
+        GotoArr(9.2);
+        R_SEUIL_SHARP = 0.25;
+        GotoDist(2.5);
+        GotoThet(-3.14159);
+        GotoDist(4);
+        R_SEUIL_SHARP = 1;
+        GotoDist(3.5);
     }
     else if (SCouleur == VIOLET) {  
-        end.attach(&endFonc, 30);
-        //GotoDist(8.2);
-        //GotoArr(8.2);
-        GotoDist(2);
+        end.attach(&endFonc, 60);
+        GotoDist(9.0);
+        GotoArr(9.2);
+        R_SEUIL_SHARP = 0.25;
+        GotoDist(2.5);
         GotoThet(3.14159);
+        GotoDist(4);
+        R_SEUIL_SHARP = 1;
+        GotoDist(3.5);
     }
     else if (SCouleur == NOIR) {
         TestDist3(2,2);
@@ -72,7 +85,7 @@
     RvalRcapt3 = RvalRcapt3 > 10 ? 10 : RvalRcapt3;
     RvalRcapt3 = RvalRcapt3 < 0 ? 0 : RvalRcapt3;
     
-    if (RvalRcapt1 >= 5 || RvalRcapt2 >= 5 || RvalRcapt3 >= 5)
+    if ((RvalRcapt1 >= 5 || RvalRcapt2 >= 5 || RvalRcapt3 >= 5))
         Ravance = 0;
     else 
         Ravance = 1;
@@ -87,6 +100,8 @@
     roboclaw.ForwardM1(0);
     roboclaw.ForwardM2(0);
     wait(1);
+    umbrella.setMaxTorque(400);
+    wait(1);
     umbrella.setGoal(300);
     while(1);
 }