Go Down

Topic: Problem with the line follower (Read 3511 times) previous topic - next topic


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.

Go Up