Software
The software for the autonomous car was not overly complicated, but it provides most of the functionality we could have hoped for.   The drive motor is controlled by the 8515's pulse width modulator to give us good control over the speed of the vehicle.   The drive direction, steering control, and photo-sensors use I/O ports.   The heuristic described in the "high level design" section above is implemented using a single state machine design style.

There is one state in the machine for each of the photo-sensors.   We tried to assume as little as possible about the width of the line relative to the spacing of the photo-sensors, though ideally the width of the line will be smaller than the minimum spacing between photo-sensors (about 2.5cm, but configurable).   The machine polls the inputs for a potential state change every 10ms.   We determined (by experiment) that this time base was necessary to ensure that none of the photo-sensors would cross the line without the car "noticing."   The state machine itself follows quite directly from the heuristic described above, and we will leave a more thorough description of it to our code (see appendix A).

In order to avoid the need for switches, our car starts and stops itself based on the status of the photo-sensors.   The car will not start moving until the middle photo-sensor (and only the middle photo-sensor) is on the line.   If no photo-sensor detects the line for 1.5 seconds, the car stops; it assumes that the line has ended, or that it is hopelessly lost.   If all of the photo-sensors detect darkness, then the car stops since it has probably been picked up.   We can take advantage of this feature when designing courses by placing a thick cross bar at the end of the course (like a T) to stop the car at the end.