Hello I’ve been having issues getting the 3pi to demonstrate the solution correctly
The robot explores the maze correctly, using a slightly modified version of the demo maze exploration code. And as far as I can tell, it records the correct solution: ie the turns that the robot should make are correctly displayed on the lcd screen, so I’m assuming my maze length and turn storage is working correctly
But, when demonstrating a solution (L,S,[end of maze]) the robot will get to the first junction, carry straight on instead of turning left, and exits the “for” loop which it should repeat (as it makes the finish noise which is inserted after the loop for debugging purposes)
I have tried comparing my code to the example code, but apart from variable names I cannot spot any differences that should affect the output from the robot.
The variable “solution” is a char array and stores the route. The variable “juncnum” is a unsigned char and stores the number of junctions.
{
set_motors(0,0);
display_solution();
play_from_program_space(finish);
delay_ms(200);
while(!button_is_pressed(BUTTON_B));
while(button_is_pressed(BUTTON_B));
delay_ms(1000);
int i;
for(i=0;i<juncnum;i++);
{
linefollow();
set_motors(50,50);
delay_ms(50);
set_motors(40,40);
delay_ms(200);
turn(solution[i]);
}
play_from_program_space(finish);
linefollow();
}
Is there a way I can output the maze length (the unsigned char “juncnum”) to the LCD screen to check this is not the cause of the issue? I have tried simply outputting the variable to the screen but this didn’t work.
Can anyone think why the robot would not turn the correct way even though the LCD displays the correct solution?
And would a youtube video help in this diagnosis?