![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ROBOTIC COMPETITION PARIS 2017
Fork of _test_suivi_mur by
main.cpp@8:72d684a69957, 2017-05-31 (annotated)
- Committer:
- syasya
- Date:
- Wed May 31 12:22:01 2017 +0000
- Revision:
- 8:72d684a69957
- Parent:
- 7:64bfecbb3000
OK
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
syasya | 7:64bfecbb3000 | 1 | |
vermaelen | 2:82b72fa8dbcd | 2 | #include "fct.h" |
syasya | 7:64bfecbb3000 | 3 | |
syasya | 7:64bfecbb3000 | 4 | |
vermaelen | 3:b91371837109 | 5 | BusOut ledsetat(p12,p13); |
vermaelen | 0:dcb865a03d57 | 6 | |
vermaelen | 0:dcb865a03d57 | 7 | int main() |
vermaelen | 0:dcb865a03d57 | 8 | { |
vermaelen | 2:82b72fa8dbcd | 9 | int etat=0; |
vermaelen | 2:82b72fa8dbcd | 10 | init(); |
vermaelen | 0:dcb865a03d57 | 11 | while(1) { |
syasya | 7:64bfecbb3000 | 12 | // 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); |
vermaelen | 2:82b72fa8dbcd | 13 | //wait(0.05); |
vermaelen | 3:b91371837109 | 14 | ledsetat.write(etat); |
vermaelen | 2:82b72fa8dbcd | 15 | switch(etat) { |
vermaelen | 2:82b72fa8dbcd | 16 | case 0 : |
vermaelen | 3:b91371837109 | 17 | if((AN2>10 && AN2<20) || US3<13) { |
vermaelen | 2:82b72fa8dbcd | 18 | etat=1; |
syasya | 7:64bfecbb3000 | 19 | stop(); |
vermaelen | 2:82b72fa8dbcd | 20 | } |
vermaelen | 3:b91371837109 | 21 | if(US2>100 && US1<40) { |
vermaelen | 3:b91371837109 | 22 | etat=2; |
syasya | 7:64bfecbb3000 | 23 | stop(); |
vermaelen | 3:b91371837109 | 24 | } |
vermaelen | 2:82b72fa8dbcd | 25 | break; |
vermaelen | 2:82b72fa8dbcd | 26 | case 1 : |
vermaelen | 4:78a9354fcee8 | 27 | if(US2>100 && US1<40) { |
vermaelen | 4:78a9354fcee8 | 28 | etat=2; |
syasya | 7:64bfecbb3000 | 29 | stop(); |
vermaelen | 4:78a9354fcee8 | 30 | } |
vermaelen | 2:82b72fa8dbcd | 31 | if(AN2>30) { |
vermaelen | 2:82b72fa8dbcd | 32 | etat=0; |
vermaelen | 3:b91371837109 | 33 | t2.start(); |
vermaelen | 3:b91371837109 | 34 | t2.reset(); |
syasya | 7:64bfecbb3000 | 35 | stop(); |
vermaelen | 2:82b72fa8dbcd | 36 | } |
vermaelen | 2:82b72fa8dbcd | 37 | break; |
vermaelen | 3:b91371837109 | 38 | case 2 : |
vermaelen | 3:b91371837109 | 39 | if((AN2>10 && AN2<20) || US3<13) { |
vermaelen | 3:b91371837109 | 40 | etat=1; |
syasya | 7:64bfecbb3000 | 41 | stop(); |
vermaelen | 3:b91371837109 | 42 | } |
vermaelen | 6:5f7df5c74a77 | 43 | if(t2.read()>2.5) { |
vermaelen | 3:b91371837109 | 44 | etat=0; |
vermaelen | 3:b91371837109 | 45 | } |
vermaelen | 3:b91371837109 | 46 | break; |
syasya | 7:64bfecbb3000 | 47 | |
vermaelen | 2:82b72fa8dbcd | 48 | } |
vermaelen | 2:82b72fa8dbcd | 49 | switch(etat) { |
vermaelen | 2:82b72fa8dbcd | 50 | case 0 : |
vermaelen | 2:82b72fa8dbcd | 51 | suivi_mur(); |
vermaelen | 2:82b72fa8dbcd | 52 | break; |
vermaelen | 2:82b72fa8dbcd | 53 | case 1 : |
vermaelen | 2:82b72fa8dbcd | 54 | rotation_horaire(); |
vermaelen | 2:82b72fa8dbcd | 55 | break; |
vermaelen | 3:b91371837109 | 56 | case 2 : |
vermaelen | 3:b91371837109 | 57 | contournement(); |
vermaelen | 3:b91371837109 | 58 | break; |
vermaelen | 2:82b72fa8dbcd | 59 | } |
vermaelen | 1:714fd6b732be | 60 | |
vermaelen | 0:dcb865a03d57 | 61 | } |
vermaelen | 0:dcb865a03d57 | 62 | } |