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
Diff: main.cpp
- Revision:
- 8:94ecfe411d02
- Parent:
- 7:753e901d441b
- Child:
- 9:2113adf37c66
--- a/main.cpp Mon May 20 14:58:09 2019 +0000 +++ b/main.cpp Thu May 23 13:54:45 2019 +0000 @@ -1,15 +1,24 @@ #include "mbed.h" #include "CAN_asser.h" + +CAN can(PB_8, PB_9,1000000); + +bool flagFinDpl = true; + +void automate_test(); + int main(void) { bool quit = false; can_init(); + can.attach(&isr_can); while(!quit) { - trait_can(); + trait_can(); + automate_test(); } return 0; @@ -17,23 +26,29 @@ void automate_test() { - static typedef enum{AVANCE,TOURNE} type_etat; - type_etat etat = AVANCE; + typedef enum{AVANCE,TOURNE} type_etat; + static type_etat etat = AVANCE; switch(etat) - { - case AVANCE: - Gostraight(500,0,0,0); - - if(FlagFinDpl) - etat = TOURNE; - break; - - case TOURNE: - Rotate(900); - - if(FlagFinDpl) - etat = AVANCE; - break; + { + case AVANCE: + + if(flagFinDpl) + { + Rotate(900); + etat = TOURNE; + flagFinDpl = false; + } + break; + + case TOURNE: + + if(flagFinDpl) + { + GoStraight(500,0,0,0); + etat = AVANCE; + flagFinDpl = false; + } + break; } } \ No newline at end of file