Controller for food in snake game
Dependencies: MMA8451Q TSI mbed
Fork of foodcontroller3 by
Revision 4:1961b60aa8fb, committed 2016-06-09
- Comitter:
- danlock10y
- Date:
- Thu Jun 09 10:31:59 2016 +0000
- Parent:
- 3:768cca7d53fe
- Commit message:
- Working food controller with 2 axis and variable velocity; ; needs comments
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
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