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:
- 31:85d9fb71f921
- Parent:
- 29:6bce50d6530c
- Child:
- 32:84bcb8f2667a
--- a/main.cpp Fri Jun 07 09:30:46 2019 +0000 +++ b/main.cpp Fri Jun 07 09:47:52 2019 +0000 @@ -9,7 +9,7 @@ void automate_testABalle(Robot&, bool&); void automate_deplacement(Robot&); void automate_vitesse(Robot&); -void automate_fin_de_partie(Robot&); +bool automate_fin_de_partie(Robot&); bool automate_arretUrgence(Robot&); typedef enum{TURN_FAST, CORRECT_GAUCHE, CORRECT_DROITE, GO_STRAIGHT} type_etat_deplacement; @@ -26,11 +26,14 @@ if(!Robot::Jack) { // Trois balles en début de partie à l'aveugle - while( !automate_aveugle(robot, ejecte) ); + if( !automate_aveugle(robot, ejecte) ); + else if(automate_fin_de_partie(robot)) + { + robot.stopRouleau(); + break; + } automate_ejecte(robot, ejecte); - - automate_fin_de_partie(robot); // Gestion du lancer de balle /*automate_testABalle(robot, ejecte); @@ -44,9 +47,11 @@ // Gestion de la vitesse en fonction de l'état actuel automate_vitesse(robot);*/ } + + return 0; } -void automate_fin_de_partie(Robot& robot) +bool automate_fin_de_partie(Robot& robot) { typedef enum{AVANCE, EXPLOSE_BALLON, FIN_PARTIE} type_etat; static type_etat etat = AVANCE; @@ -72,13 +77,14 @@ break; case FIN_PARTIE: - if(T_fin.read() >= 2.0f) + if(T_fin.read() >= 2.0f && robot.baisseBras()) { - robot.baisseBras(); robot.arreteDisquette(); - } - break; + return true; + } } + + return false; } bool automate_arretUrgence(Robot& robot)