will this work to follow an object and when its too close to turn?
while(1)
{
scan();
//object on left
if(scan_angle > 57 && sharp_IR_reading > scan_thresh)
robot_turn_left();
//object on right
else if(scan_angle < 41 && sharp_IR_reading > scan_thresh)
robot_turn_right();
// object at close distance
else if(sharp_IR_reading == scan_thresh)
robot_turn_left();
//object is centered
else if(sharp_IR_reading > scan_thresh && scan_angle >41 <57)
robot_go_straight();
delay_cycles(400);
}
can anyone find any errors or if this would work as an idea?