Basic Line Following Program motors: p25, p10 inputs: p15, p16 Current settings: lineToSpeedFactor = 10 / 3 speedModifier = -4
Dependencies: mbed
Fork of RenBuggyLineFollower by
This small program lets a buggy follow a line (black line on white background)
Diff: main.cpp
- Revision:
- 3:936111f70e37
- Parent:
- 2:2439f5a4a93d
- Child:
- 4:8f614e0b1cea
--- a/main.cpp Thu Jul 14 10:55:33 2016 +0000 +++ b/main.cpp Thu Jul 14 10:57:20 2016 +0000 @@ -41,13 +41,13 @@ newLine = 2; else newLine = 1; - searching = true + searching = true; } if(searching){ if(abs(a - b)<0.2){ newLine = oldLine; } - counter++ + counter++; if(counter>300){ newLine = 3 - oldLine; counter = 0; @@ -69,8 +69,8 @@ int main() { - searching = false - counter = 0 + searching = false; + counter = 0; while(true){ getMotorSpeeds(ain0.read(),ain1.read()); pwm0 = Lmotor;