Problem with the line follower
Topic: Problem with the line follower
(Read 2838 times)
Re: Problem with the line follower
Jan 14, 2013, 12:10 am
In getline(), replace all the statements like
if (s1Left == 1)
if (digitalRead(s1Left) == HIGH)
so that your logic is based on the sensor input values rather than the pin numbers. I haven't checked through it in detail but the basic approach of looking for combinations of sensors being high/low looks credible, as long as you are only dealing with the simple case of a line at right angles to the array of sensors.
Having made that change I suggest you comment out or disable all the code to do with motors, add code to print out
whenever it changes, and move your 'bot by hand over a sample line and confirm that it outputs the correct values for lineplace at the correct times.