IT GOES NORTH MOST OF THE TIME
Dependencies: HMC6352 Motor mbed
Revision 14:9f5ce2fd2cfc, committed 2012-10-10
- Comitter:
- vsavkin3
- Date:
- Wed Oct 10 20:14:15 2012 +0000
- Parent:
- 13:76a6ce8b2116
- Child:
- 15:ff95ff245fc0
- Commit message:
- Jawohl
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 10 10:10:25 2012 +0000 +++ b/main.cpp Wed Oct 10 20:14:15 2012 +0000 @@ -93,7 +93,7 @@ NorthOn=0; dir=Left; } - else if(((globalDir > 30 && globalDir <= 180)||(globalDir > 180 && globalDir <= 330))&&NorthOn) + else if(((globalDir >= 30 && globalDir <= 330))&&NorthOn) { right.speed(0); @@ -175,10 +175,18 @@ dir=Forward; } else - { if(globalDir<=180){ - right.speed(1); - left.speed(-1);} - else{right.speed(-1); left.speed(1);} + { + //If it's not going north, choose which way to turn to get north + if(globalDir<=180) + { + right.speed(1); + left.speed(-1); + } + else + { + right.speed(-1); + left.speed(1); + } } break; }