Loading...
Pages: 1 [2]   Go Down
Author Topic: Problem with the line follower  (Read 506 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Tesla Member
***
Karma: 100
Posts: 6787
-
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

Pages: 1 [2]   Go Up
Print
 
Jump to: