I haven't posted a Lego robot or a line follower, so I thought I'd do both together.
Line followers have been done to death. I've blown the dust off my Lego RCX. Yes, that's right: Noah had one of these controlling the Ark, but we haven't seen any BOA-bots in ages. Time to get back in the saddle.
There are three things going on here:
1) It's got 2 light sensors and a bit more intelligence than the time-honoured "change direction when you loose the line" type algorithm.
2) I've added a differential gear. It's part of the feedback train rather than the drive train. The diff turns a rotation sensor. As you can see, if both wheels turn, the diff doesn't turn. If one wheel turns, the diff runs one way. If the other wheel turns (the same direction) the diff turns the other way. This means it "knows" with reasonable precision what rotational angle it's sitting at in the ground plane.Of course, it also means it has no idea how far it's travelled.
3) I'm programming it in a subset of C. I'm not a C programmer. I prefer assembly, or even LabVIEW. This should be good sport to watch.
Oh, yeah. The name. LLAF = "Lego Line (Another) Follower."
Now, about that software. Time to do some headscratching.