Dependencies:   mbed DRV8825

Revision:
26:bb2b778bd351
Parent:
25:869b1c1f51a7
--- a/main.cpp	Thu Oct 29 07:53:25 2020 +0000
+++ b/main.cpp	Tue Nov 03 16:29:13 2020 +0000
@@ -11,6 +11,7 @@
 Ticker TickerGlobal; // Comptage du temps écoulé
 int cptGlobal = 0;
 bool match = 0; // Match == 1 => Le match est en cours
+//bool toggledSwitch = 0;
 
 
 /* Prototypes */
@@ -71,27 +72,54 @@
     /* Autres */
     //btnBlue.rise(&boutonBleu);
 
+    if (SwitchStrategie == 1) {
+        stratX_select = objX_bleu;
+        x = x_init_bleu;
+        y = y_init;
+        O = O_init_bleu;
+        Led = 1;
+    } else {
+        stratX_select = objX_jaune;
+        x = x_init_jaune;
+        y = y_init;
+        O = O_init_jaune;
+        Led = 0;
+    }
+
     /* Boucle infinie */
     while(1) {
         if (Tirette == 1 && match == 0) { // Stand-by
             // Le match n'a pas encore commencé
-            // La LED est allumée
             // Le compteur du match reste à 0
-            Led = 1;
+            //Led = 1;
             match = 0;
             cptGlobal=0;
+
+            if (SwitchStrategie == 1) {
+                stratX_select = objX_bleu;
+                x = x_init_bleu;
+                y = y_init;
+                O = O_init_bleu;
+                Led = 1;
+            } else {
+                stratX_select = objX_jaune;
+                x = x_init_jaune;
+                y = y_init;
+                O = O_init_jaune;
+                Led = 0;
+            }
         }
 
         else if (Tirette == 0 && match == 0) { // Début du match
             // Le match débute
             // La LED s'éteind
-            Led = 0;
+            //Led = 0;
             match = 1;
             cptGlobal = 0;
-            
+
             indiceStrategie = 1;
             action = objEtape[indiceStrategie];
-            xC = objX[indiceStrategie];
+            xC = stratX_select[indiceStrategie];
             yC = objY[indiceStrategie];
         }