Time is good

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Revision:
48:03da1aead032
Parent:
46:5658af4e5149
Child:
49:5e2f7323f280
diff -r 5658af4e5149 -r 03da1aead032 main.cpp
--- a/main.cpp	Mon Apr 25 12:38:58 2016 +0000
+++ b/main.cpp	Thu Apr 28 08:11:25 2016 +0000
@@ -1,16 +1,9 @@
 #include "func.h"
 
-#define ATTENTE 0
-#define GO 1
-#define STOP 2
-#define ADR 0x80
-#define dt 10000
-
 /* Déclaration des différents éléments de l'IHM */
 
-/* Carte boutons, la NUCLEO n'arrive pas à récupérer les signaux CAMP et START */
-InterruptIn CAMP(PH_0);
-InterruptIn START(PH_1);
+InterruptIn CAMP(PA_15);
+InterruptIn START(PB_7);
 DigitalOut LEDR(PC_2);
 DigitalOut LEDV(PC_3);
 
@@ -27,8 +20,8 @@
 DigitalOut rouge(PC_8);
 
 /* AX12 - non fonctionnels, je pense que le souci vient de la bibliothèque car la trame n'est pas correcte (analyseur logique) */
-AX12 left_hand(PA_9, PA_10, 4, 250000);
-AX12 right_hand(PA_9, PA_10, 1, 250000);
+//AX12 left_hand(PA_9, PA_10, 4, 250000);
+//AX12 right_hand(PA_9, PA_10, 1, 250000);
 
 /* Sharp */
 AnalogIn capt1(PA_4);
@@ -48,11 +41,11 @@
 Ticker ticker;
 
 Serial logger(USBTX, USBRX);
-//Serial logger(PA_2, PA_3);
+//Serial logger(PA_9, PA_10);
 RoboClaw roboclaw(ADR, 460800, PA_11, PA_12);
 Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw);
 
-int SIMON_i = 0, SIMON_state = 0;
+int SIMON_i = 0, SIMON_state = 0, SCouleur = 1, SStart = 0;
 bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false;
 
 void init(void);
@@ -62,27 +55,26 @@
 int main(void)
 {
     init();
-    while(1) JPO();
+    while(1);
 }
 
 void init(void)
 {
     logger.baud(9600);
-    logger.printf("Hello from main !\n\r");
+    logger.printf("Coucou!\n\r");
     roboclaw.ForwardM1(0);
     roboclaw.ForwardM2(0);
-    LEDV = 1;
-    while(button);
-    LEDV = 0;
+    while(SStart==0);
+    wait(1);
+    odo.setPos(110, 1000, 0);
     roboclaw.ResetEnc();
     init_interrupt();
-    ticker.attach_us(&update_main, dt); // 100 Hz    
     wait_ms(100);
     logger.printf("End init\n\r");
 }
 
 void update_main(void)
 {
-    odo.update_odo();
+    //odo.update_odo();
     //checkAround();
 }
\ No newline at end of file