So my line follower path is basically a path with ONLY right angle turns, lots of 'fake' turns with dead ends and lots of 'T' joints and junction joints. So you can probably think of it as a maze. Except that my goal isn't to reach the end of it (there is no end), but it is to traverse every single section of the maze (or as many as I can), and then STOP my bot.
I coded the maze 'solver' succesfuly, using the priority order of RIGHT>FORWARD>LEFT.
I have 7 sensors, arranged as "o o o o o o o"
------------------------------6 5 4 3 2 1 0
I've stored their's values (digital) into an array a[7].
I have functions for Fwd, for Right, for Left, and I call them with the following logic:
if(a[0]==0)
{right();}
else if(a[0]==1 && a[1]==1 && a[2]==1 && a[3]==1 && a[4]==1 && a[5]==1 && a[6]==1)
{left();}
else
{fwd();}
So my bot moves right whenever it encounters a right turn, OR a T joint. If it ever encounters a sole left turn, it keeps going forward till it leaves the path, and THEN turns left. This solves the U Turn at a dead end problem simoultaneously.
There are obviously other ways to code this but this seemed the shortest and it works well.
Now back to the problem. I need idea/advice/guidance on how to recognize when it has completely traversed the maze (every part of it).
I'm using Atmega168 with 512 bytes of EEPROM.