Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 38:a8b84be7dce5
- Parent:
- 37:65650aab8387
- Child:
- 39:82c1de84bf40
diff -r 65650aab8387 -r a8b84be7dce5 main.cpp
--- a/main.cpp	Sat Jun 08 02:47:31 2019 +0000
+++ b/main.cpp	Sat Jun 08 06:17:19 2019 +0000
@@ -23,9 +23,7 @@
     Robot robot;
     
     while(1)
-    {
         automate_run(robot);
-    }   
 }
 
 void automate_run(Robot& robot)
@@ -180,7 +178,7 @@
                     T_corrige.reset();
                 }
             }
-            else if( T_corrige.read() > 1.5f )
+            else if( T_corrige.read() > 1.0f )
             {
                 etat = RAS;
                 T_corrige.stop();
@@ -311,7 +309,7 @@
 
 bool automate_fin_de_partie(Robot& robot)
 {
-    typedef enum{AVANCE, EXPLOSE_BALLON, FIN_PARTIE} type_etat;
+    typedef enum{AVANCE, INTERMEDIAIRE, EXPLOSE_BALLON, FIN_PARTIE} type_etat;
     static type_etat etat = AVANCE;
     
     static Timer T_fin;
@@ -319,7 +317,12 @@
     switch(etat)
     {
         case AVANCE:
-            if(robot.GoToXYT(robot.pos(Robot::X),3600,0))
+            if(robot.tourne( -robot.pos(Robot::THETA) ))//if(robot.GoToXYT(robot.pos(Robot::X),3600,0))
+                etat = INTERMEDIAIRE;
+            break;
+            
+        case INTERMEDIAIRE:
+            if(robot.avance( 4000 - robot.pos(Robot::Y) - 350))
                 etat = EXPLOSE_BALLON;
             break;