QTR-8A - Maze Solver Robot

Hi,

I am trying to make a maze solver robot and I am using the Pololu QTR-8A - the robot is follow the line okay but when i done the algorithm for solve the maze to select the shortest path and at the end spot stop the robot till the next start but the robot didn’t stop in the end spot And continues to move on the lines so can you help me to found why this happen ?

this’s my code :

PID_Solver_Maze.ino (20.3 KB)

Thanks.

Hello.

The way your code is written, it looks like it is expecting the MazeSolve() function to be called once from the main loop, but you are calling PID() instead. This means your program is never executing the code in MazeSolve() that is supposed to run after PID() has found an intersection.

Brandon

i see , i change it but the robot move randomly on the line stop once and run another strange behavior , can’t move following the line. but it see the line and move on it but randomly .

PID_Solver_Maze.ino (20.3 KB)

Thanks for your help.

It is very difficult to diagnose a problem from that kind of description. If you pulled this code from another source and it wasn’t written for your robot, I suggest taking it slow instead of trying to get it all to work at once. You might consider commenting out portions of code and slowly adding it back. Another helpful tool when troubleshooting code is to use some kind of feedback, such as LEDs, an LCD, or even the Serial Monitor to get some idea of what the program is doing. For example, you might try having the robot do something visual (like light an LED) based on what intersection it finds. This could let you know if it is falsely identifying intersections. It might be helpful to have it run at a low speed, and only increasing the speed once you know the rest of your code is working correctly.

Brandon