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:
- 9:2113adf37c66
- Parent:
- 8:94ecfe411d02
- Child:
- 10:efa507ba2b35
diff -r 94ecfe411d02 -r 2113adf37c66 main.cpp
--- a/main.cpp Thu May 23 13:54:45 2019 +0000
+++ b/main.cpp Thu May 23 15:37:33 2019 +0000
@@ -1,54 +1,33 @@
#include "mbed.h"
#include "CAN_asser.h"
-
-
-CAN can(PB_8, PB_9,1000000);
+#include "Deplacement.h"
-bool flagFinDpl = true;
-
-void automate_test();
+void automate_test(Deplacement& R);
int main(void)
{
- bool quit = false;
+ Deplacement robot;
- can_init();
- can.attach(&isr_can);
-
- while(!quit)
- {
- trait_can();
- automate_test();
- }
-
- return 0;
+ while(1)
+ automate_test(robot);
+
}
-void automate_test()
+void automate_test(Deplacement& R)
{
- typedef enum{AVANCE,TOURNE} type_etat;
+ typedef enum {AVANCE, TOURNE} type_etat;
static type_etat etat = AVANCE;
switch(etat)
- {
+ {
case AVANCE:
-
- if(flagFinDpl)
- {
- Rotate(900);
+ if(R.avance(500))
etat = TOURNE;
- flagFinDpl = false;
- }
break;
case TOURNE:
-
- if(flagFinDpl)
- {
- GoStraight(500,0,0,0);
+ if(R.tourne(900))
etat = AVANCE;
- flagFinDpl = false;
- }
break;
}
}
\ No newline at end of file