Go Down

Topic: Problem with the line follower (Read 1 time) previous topic - next topic

PeterH

In getline(), replace all the statements like if (s1Left == 1) with 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 lineplace 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.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up