Pages: 1 [2]   Go Down
Author Topic: Problem with the line follower  (Read 1275 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12534
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: 1 [2]   Go Up
Jump to: