So, i need help, i want my robot to follow a white line autonomously, I’m not quite sure how to program this, any suggestions on how to start?
First I would start by figuring out what sensor value the line sensor returns over your surface.
I have never tried this strategy myself, but I have heard of people using 3 line trackers in a row, so that the middle one is always on the line and the other 2 are not. If the robot turns, the one in the middle will go off the line, and one of the others will go on. this could initiate a command to speed up one side of the robot until the middle on is back on again.
The other idea is one I just made up. I shall call it the lighthouse method, because it uses the same idea as “leading lights”. Pretty much, you would have a line tracker at the front and back of your robot. Both would start on the line, but if one went off, the robot would begin to turn until they were back on. I think the first method is probably the best but who knows? I have not tried either.
With the second method its really hard to tell if you went off to the left or right of the line.
The standard is at least 2 sensors in the front straddling the line, if one gets bigger than the other you know which way you deviated off the line. Add more sensors to give yourself more breathing room and wider range of sensing.
This is an old but good guide on using the line tracker.