Hello, i m trying to make my 3pi robot to solve a maze , but i encountered a problem, the 3pi is going perfectly throw intersections, it turns well, it uses the left hand on the wall strategy good, but when it gets to the end of the maze , ( a 16 by 9 cm rectangle), it doesn t stop, it spins,i used the code from : https://www.pololu.com/docs/0J21/8.b .
if(sensors[1] >500 && sensors[2] > 500 && sensors[3] > 500){
play_from_program_space(welcome);
break;
This is my condition to stop.
It plays the sound, but it doesn t stop, is it possible my second while is not good?
while(1)// bucla infinita
{
// Wait for the user to press a button
wait_for_button_release(BUTTON_B);
int i;
for(i=0;i<path_length;i++)
{
follow_segment();
set_motors(50,50);
delay_ms(50);
set_motors(40,40);
delay_ms(200);
// Make a turn according to the instruction stored in
// path[i].
turn(path[i]);
}
// Follow the last segment up to the finish.
follow_segment();
}