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: MMA8451Q TSI mbed
Fork of snakecontroller by
Diff: main.cpp
- Revision:
- 4:1961b60aa8fb
- Parent:
- 3:768cca7d53fe
- Child:
- 5:97c02241511c
diff -r 768cca7d53fe -r 1961b60aa8fb main.cpp
--- a/main.cpp Thu Jun 09 10:22:08 2016 +0000
+++ b/main.cpp Thu Jun 09 10:31:59 2016 +0000
@@ -144,12 +144,30 @@
wait(0.1);
- /*if(abs(accY) > abs(accX))
+ if(abs(accY) > abs(accX))
{
- if(forward == e)
+ if(forward == true)
+ {
+ Direction = 0;
+ }//endif
+ else
{
-
- }
- }*/
+ Direction = 2;
+ }//endelse
+ }//endif
+ else
+ {
+ if(right == true)
+ {
+ Direction = 1;
+ }//endif
+ else
+ {
+ Direction = 3;
+ }//endelse
+ }//endelse
+
+ printf("Direction = %d \r\n", Direction);
+
}//endwhile
}//endmain
