![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
...
main.cpp@2:82b72fa8dbcd, 2017-05-28 (annotated)
- Committer:
- vermaelen
- Date:
- Sun May 28 17:36:57 2017 +0000
- Revision:
- 2:82b72fa8dbcd
- Parent:
- 1:714fd6b732be
- Child:
- 3:b91371837109
V1;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vermaelen | 0:dcb865a03d57 | 1 | #include "mbed.h" |
vermaelen | 2:82b72fa8dbcd | 2 | #include "fct.h" |
vermaelen | 0:dcb865a03d57 | 3 | |
vermaelen | 0:dcb865a03d57 | 4 | int main() |
vermaelen | 0:dcb865a03d57 | 5 | { |
vermaelen | 2:82b72fa8dbcd | 6 | int etat=0; |
vermaelen | 2:82b72fa8dbcd | 7 | init(); |
vermaelen | 0:dcb865a03d57 | 8 | while(1) { |
vermaelen | 2:82b72fa8dbcd | 9 | //printf("etat=%d US1=%.0f US2=%.0f erreur=%.0f cmdD=%.0f cmdG=%.0f\n\r",etat,US1,US2,(US2-US1),cmdD,cmdG); |
vermaelen | 2:82b72fa8dbcd | 10 | //wait(0.05); |
vermaelen | 2:82b72fa8dbcd | 11 | switch(etat) { |
vermaelen | 2:82b72fa8dbcd | 12 | case 0 : |
vermaelen | 2:82b72fa8dbcd | 13 | if(AN2<20 || US3<13) { |
vermaelen | 2:82b72fa8dbcd | 14 | etat=1; |
vermaelen | 2:82b72fa8dbcd | 15 | stopMotor(); |
vermaelen | 2:82b72fa8dbcd | 16 | } |
vermaelen | 2:82b72fa8dbcd | 17 | break; |
vermaelen | 2:82b72fa8dbcd | 18 | case 1 : |
vermaelen | 2:82b72fa8dbcd | 19 | if(AN2>30) { |
vermaelen | 2:82b72fa8dbcd | 20 | etat=0; |
vermaelen | 2:82b72fa8dbcd | 21 | stopMotor(); |
vermaelen | 2:82b72fa8dbcd | 22 | } |
vermaelen | 2:82b72fa8dbcd | 23 | break; |
vermaelen | 2:82b72fa8dbcd | 24 | } |
vermaelen | 2:82b72fa8dbcd | 25 | switch(etat) { |
vermaelen | 2:82b72fa8dbcd | 26 | case 0 : |
vermaelen | 2:82b72fa8dbcd | 27 | suivi_mur(); |
vermaelen | 2:82b72fa8dbcd | 28 | break; |
vermaelen | 2:82b72fa8dbcd | 29 | case 1 : |
vermaelen | 2:82b72fa8dbcd | 30 | rotation_horaire(); |
vermaelen | 2:82b72fa8dbcd | 31 | break; |
vermaelen | 2:82b72fa8dbcd | 32 | } |
vermaelen | 1:714fd6b732be | 33 | |
vermaelen | 0:dcb865a03d57 | 34 | } |
vermaelen | 0:dcb865a03d57 | 35 | } |