FRC_equipe1 / Mbed 2 deprecated FRC_2019

Dependencies:   mbed

main.cpp

Committer:
Wael_H
Date:
2019-05-23
Revision:
10:efa507ba2b35
Parent:
9:2113adf37c66
Child:
11:e8c4a1c6553d
Child:
13:9c62e263f245

File content as of revision 10:efa507ba2b35:

#include "mbed.h"
#include "CAN_asser.h"
#include "Robot.h"

/*//Bonus fin de partie
PwmOut bonus(PA_10);

//Disquette
PwmOut Servo_Ballon(PB_7);
PwmOut Mot_Ballon(PB_6);*/


void automate_test(Robot& R);


int main(void)
{
    Robot robot;
    
    while(1)
        automate_test(robot);
}


void automate_test(Robot& R)
{
    typedef enum {AVANCE, TOURNE} type_etat;
    static type_etat etat = AVANCE;
    
    switch(etat)
    {
        case AVANCE:
            if(R.avance(500))
                etat = TOURNE;
            break;
            
        case TOURNE:
            if(R.tourne(900))
                etat = AVANCE;
            break;
    }
}