FRC_equipe1 / Mbed 2 deprecated FRC_2019

Dependencies:   mbed

Committer:
Wael_H
Date:
Tue Jun 04 08:49:01 2019 +0000
Revision:
16:05665faaa489
Parent:
15:3d4543a6c100
Child:
17:aae5361ddddf
tests deplacements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wael_H 2:8971078b1ccf 1 #include "mbed.h"
Wael_H 5:34048faec367 2 #include "CAN_asser.h"
Wael_H 10:efa507ba2b35 3 #include "Robot.h"
Wael_H 10:efa507ba2b35 4
Wael_H 16:05665faaa489 5 void automate_testDeplacement(Robot&);
Wael_H 8:94ecfe411d02 6
Wael_H 2:8971078b1ccf 7 int main(void)
Wael_H 2:8971078b1ccf 8 {
Wael_H 10:efa507ba2b35 9 Robot robot;
Wael_H 7:753e901d441b 10
Wael_H 16:05665faaa489 11 robot.setSpeed(50,300);
Wael_H 15:3d4543a6c100 12
Wael_H 15:3d4543a6c100 13 while(1)
Wael_H 16:05665faaa489 14 automate_testDeplacement(robot);
Wael_H 15:3d4543a6c100 15 }
Wael_H 15:3d4543a6c100 16
Wael_H 16:05665faaa489 17 void automate_testDeplacement(Robot& robot)
Wael_H 15:3d4543a6c100 18 {
Wael_H 16:05665faaa489 19 typedef enum{AVANCE,TOURNE,GOTO,SARRETE} type_etat;
Wael_H 16:05665faaa489 20 static type_etat etat = AVANCE;
Wael_H 7:753e901d441b 21
Wael_H 7:753e901d441b 22 switch(etat)
Wael_H 9:2113adf37c66 23 {
Wael_H 16:05665faaa489 24 case AVANCE:
Wael_H 16:05665faaa489 25 if(robot.avance(2000))
Wael_H 16:05665faaa489 26 etat = TOURNE;
Wael_H 13:9c62e263f245 27 break;
Wael_H 13:9c62e263f245 28
Wael_H 16:05665faaa489 29 case TOURNE:
Wael_H 16:05665faaa489 30 if(robot.tourne(450))
Wael_H 16:05665faaa489 31 etat = GOTO;
Wael_H 8:94ecfe411d02 32 break;
Wael_H 8:94ecfe411d02 33
Wael_H 16:05665faaa489 34 case GOTO:
Wael_H 16:05665faaa489 35 BendRadius(30,90,0,0);
Wael_H 16:05665faaa489 36 etat = SARRETE;
Wael_H 13:9c62e263f245 37 break;
Wael_H 13:9c62e263f245 38
Wael_H 16:05665faaa489 39 case SARRETE:
Wael_H 13:9c62e263f245 40 break;
Wael_H 13:9c62e263f245 41 }
Wael_H 13:9c62e263f245 42 }
Wael_H 16:05665faaa489 43