x

Dependencies:   Servo ServoArm mbed

Fork of PES_PIXY_Officiall by zhaw_st16b_pes2_10

Revision:
4:d611df1ed42b
Parent:
3:63da1d1fae15
--- a/Sources/Robot.cpp	Fri May 26 08:01:48 2017 +0000
+++ b/Sources/Robot.cpp	Fri May 26 08:24:59 2017 +0000
@@ -113,14 +113,14 @@
     }
 }
 
-int Robot::search(int* timer){
+void Robot::search(int* time){
     enum states {neutral = 0, counterMax, wallF, wallL, wallR};
     static int state = neutral;
     static int rando = -1;
     int oldx = this->pixy->getX();
     static int counter = 0;
   
-    if( this->pixy->getDetects() ) return 1;
+    //if( this->pixy->getDetects() ) return 1;
     switch( state ){
         case neutral:
             if( counter > MAX ){
@@ -128,19 +128,19 @@
             }
             else if( this->sensors[FWD].read() < NEAR ){
                 state = wallF;
-                counter = 0;
+                time = 0;
             }
             else if( this->sensors[LEFT].read() < NEAR ){
                 state = wallL;
-                counter = 0;
+                time = 0;
             }
             else if( this->sensors[RIGHT].read() < NEAR ){
                 state = wallR;
-                counter = 0;
+                time = 0;
             }
             else{
                 this->drive();
-                counter = 0;
+                time = 0;
             }
             break;
         
@@ -193,7 +193,6 @@
             break;
         
     }
-    return 1;
 }