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)
Revision 3:936111f70e37, committed 2016-07-14
- Comitter:
- DanArgust
- Date:
- Thu Jul 14 10:57:20 2016 +0000
- Parent:
- 2:2439f5a4a93d
- Child:
- 4:8f614e0b1cea
- Commit message:
- fixed minor errors
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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;