ARES
/
Timer
Time is good
Fork of Robot2016_2-0 by
Diff: main.cpp
- Revision:
- 51:1056dd73a748
- Parent:
- 49:5e2f7323f280
- Child:
- 53:bef06d5e827d
- Child:
- 77:f19cc7f81f2a
diff -r 2dea82393beb -r 1056dd73a748 main.cpp --- a/main.cpp Mon May 02 08:35:56 2016 +0000 +++ b/main.cpp Wed May 04 16:15:13 2016 +0000 @@ -3,11 +3,13 @@ /* Déclaration des différents éléments de l'IHM */ -InterruptIn CAMP(PA_15); -InterruptIn START(PB_7); +DigitalIn CAMP(PA_15); +DigitalIn START(PB_7); DigitalOut LEDR(PC_2); DigitalOut LEDV(PC_3); +BusOut drapeau(PC_8, PC_6, PC_5); + InterruptIn mybutton(USER_BUTTON); DigitalIn button(USER_BUTTON); @@ -20,7 +22,6 @@ DigitalOut blanc(PC_6); 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); @@ -31,22 +32,25 @@ AnalogIn capt4(PC_0); /* Moteurs pas à pas */ -Stepper RMot(NC, PA_8, PC_7); -Stepper ZMot(NC, PB_4, PB_10); -Stepper LMot(NC, PB_5, PB_3); +Stepper RMot(NC, PA_8, PC_7, 4); +Stepper ZMot(NC, PB_4, PB_10, 5); +Stepper LMot(NC, PB_5, PB_3, 4); /* Fins de course */ InterruptIn EndR(PB_15); InterruptIn EndZ(PB_14); InterruptIn EndL(PB_13); +DigitalIn EnR(PB_15); +DigitalIn EnZ(PB_14); +DigitalIn EnL(PB_13); Ticker ticker; //Serial logger(USBTX, USBRX); -Serial logger(PA_9, PA_10); +Serial logger(PA_2, PA_3); RoboClaw roboclaw(ADR, 460800, PA_11, PA_12); Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw); -int SIMON_i = 0, SIMON_state = 0, SCouleur = 1, SStart = 0; -bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false; +int SIMON_i = 0, SIMON_state = 0, SCouleur = VERT, SStart = 0, SSchema = 1; +bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false, SGauche = false, SDevant = false, SDroite = false; void init(void); void update_main(void); @@ -54,52 +58,56 @@ /* Debut du programme */ int main(void) { - init(); - - /*map m(&odo); + logger.printf("Depart homologation !\n\r"); + homologation(); + /*drapeau = 0; + init(); + + map m(&odo); m.addObs(obsCarr (1250, 1000, 220, 220)); m.addObs(obsCarr (1500, 750, 220, 220)); m.addObs(obsCarr (1500, 1250, 220, 220)); - + m.Execute(1000,1000); m.Execute(1500,1000); m.Execute(1500,1500); m.Execute(110,1000); - + odo.GotoThet(0); roboclaw.ForwardM1(0); roboclaw.ForwardM2(0); - - logger.printf ("Chemin Fini !");*/ - while(1); + logger.printf ("Chemin Fini !"); + + while(1);*/ } void init(void) { logger.baud(9600); logger.printf("Hello from main !\n\r"); - - bleu = 1, blanc = 1, rouge = 1; - + + init_interrupt(); + goHome(); + + SCouleur = VERT; + LEDV = 1; + LEDR = 0; + odo.setPos(110, 1000, 0); - + roboclaw.ResetEnc(); roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); + roboclaw.ForwardM2(0); wait_ms(500); - - bleu = 0, blanc = 0, rouge = 0; - - while(SStart==0); - - roboclaw.ResetEnc(); + while(1); + //depart(); init_interrupt(); wait_ms(100); - + while(START==0); logger.printf("End init\n\r"); } void update_main(void) { odo.update_odo(); - //checkAround(); + checkAround(); } \ No newline at end of file