Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- theolp
- Date:
- 2019-05-28
- Revision:
- 12:7ec2c5b674a2
- Parent:
- 11:e8c4a1c6553d
File content as of revision 12:7ec2c5b674a2:
#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; int pos[3]; //Pour cadencer la fréquence d'envoi de messages vers le module bluetooth Timer timer_dbug; timer_dbug.start(); robot.gobe(30); while(1) { //Maj de la position du robot robot.getPos(pos); //Led s'allume sur la carte si le robot a une balle robot.LedBps = robot.aBalle(); if(timer_dbug.read() > 1.f){ dbug.printf("posX : %d\n\r", pos[0]); dbug.printf("posY : %d\n\r", pos[1]); dbug.printf("Angle : %d\n\r", pos[2]); sauter_lignes(24); timer_dbug.stop(); timer_dbug.reset(); timer_debug.start(); } //Automate automate_test(robot); } } void automate_test(Robot& robot) { typedef enum {DEBUT, ATTENTE_BALLE, TOURNE, EJECTE} type_etat; static type_etat etat = DEBUT; switch(etat) { case DEBUT: robot.avance(300); etat = ATTENTE_BALLE; break; case ATTENTE_BALLE: if(robot.aBalle()){ SendRawId(ASSERVISSEMENT_STOP); etat = TOURNE; } break; case TOURNE: if(robot.tourne(1800)) etat = EJECTE; break; case EJECTE: robot.ejecte(60); etat = DEBUT; break; } }