Hello Amy, thanks for making a post here. Sounds like a very fun project! I’m sure we’ll be able to get it working.
Which kind of light sensors did you get?
In the image above, the sensor on the left is the NXT Color Sensor, and the sensor on the right is the Light Sensor. Both types work with the Bricktronics Shield software.
The first step might be to play around with the light sensors to see how well they can detect the line. Maybe make a little sketch that just reads out the raw value from the sensor and prints it to the serial console so you can see what values it reads when the sensor is on top of the line, and what values it reads when the sensor is NOT on top of the line. If the numbers change a lot between line and not-line, then you’ll be able to have the robot code know if it is over the line. You might want to build up your robot’s frame at this point to mount the two sensors just above the floor while it’s rolling around. It would be good to test out the motors and make sure you can easily drive it forward in a straight line, as well as do turns to the left and right.
For the actual line-following algorithm, it’ll be easier if you have two sensors with the line between the sensors. You can drive forward until one of the sensors detects the line, which means that you need to turn towards the sensor that detected the line. For example, if your line is curving to the right and you drive straight forward, eventually the line will move under the right-side sensor. Now you need to turn the robot a little bit to the right and resume driving forward. You probably want to start out with a slow speed at first, otherwise you might overshoot with your turns!
If you only have a single sensor, it is a little more tricky but still possible. With a single sensor you always want it to be detecting the line. If it “falls off” the line, then you want to turn in place left and right until you find the line again. It’ll probably be slower than the two-sensor line following robot, but still pretty cool!
I hope that helps, and do let us know if you have questions or need more tips.