![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ROBOTIC COMPETITION PARIS 2017
Fork of _test_suivi_mur by
main.cpp
- Committer:
- vermaelen
- Date:
- 2017-05-29
- Revision:
- 3:b91371837109
- Parent:
- 2:82b72fa8dbcd
- Child:
- 4:78a9354fcee8
File content as of revision 3:b91371837109:
#include "mbed.h" #include "fct.h" BusOut ledsetat(p12,p13); int main() { int etat=0; init(); while(1) { printf("etat=%d US1=%.0f US2=%.0f US3=%.0f erreur=%.0f AN1=%.0f AN2=%.0f cmdD=%.0f cmdG=%.0f\n\r",etat,US1,US2,US3,(US2-US1),AN1,AN2,cmdD,cmdG); //wait(0.05); ledsetat.write(etat); switch(etat) { case 0 : if((AN2>10 && AN2<20) || US3<13) { etat=1; stopMotor(); } if(US2>100 && US1<40) { etat=2; stopMotor(); } break; case 1 : if(AN2>30) { etat=0; t2.start(); t2.reset(); stopMotor(); } break; case 2 : if((AN2>10 && AN2<20) || US3<13) { etat=1; stopMotor(); } if(t2.read()>2) { etat=0; } break; } switch(etat) { case 0 : suivi_mur(); break; case 1 : rotation_horaire(); break; case 2 : contournement(); break; } } }