vf
Dependencies: Servo ServoArm mbed
Fork of PES_Official by
Diff: Sources/Robot.cpp
- Revision:
- 13:6c1f8e35b242
- Parent:
- 11:292bdbd85a9c
- Child:
- 15:915f8839fe48
diff -r c0bcb95885dd -r 6c1f8e35b242 Sources/Robot.cpp --- a/Sources/Robot.cpp Wed May 10 13:30:13 2017 +0000 +++ b/Sources/Robot.cpp Wed May 10 16:53:01 2017 +0000 @@ -222,6 +222,7 @@ int Robot::search(int* timer){ + //return 1; enum states {neutral = 0, max, wallF, wallL, wallR, legoF, legoL, legoR }; static int state = neutral; @@ -237,9 +238,9 @@ if( counter > MAX ){ state = max; } - /*else if( this->sensors[FWD] < NEAR ){ + else if( this->sensors[FWD] < NEAR ){ state = wallF; - }*/ + } else if( this->sensors[LEFT] < NEAR ){ state = wallL; } @@ -309,7 +310,7 @@ case legoF: //counter++; - if( this->sensors[FWD_L] > 0.15f ){ + if( this->sensors[FWD_L] > 0.17f ){ this->drive(); } else{ @@ -322,7 +323,7 @@ case legoL: counter++; - if( this->sensors[FWD_L] < NEAR_LEGO+0.05f ){ + if( this->sensors[FWD_L] < NEAR_LEGO + 0.05f ){ this->turnLeft(); } else{ @@ -332,7 +333,7 @@ case legoR: counter++; - if( this->sensors[FWD_L] < NEAR_LEGO+0.05f ){ + if( this->sensors[FWD_L] < NEAR_LEGO + 0.05f ){ this->turnRight(); } else{