David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
Diff: main.cpp
- Revision:
- 53:73565a3ef5c5
- Parent:
- 52:05a8e919ddb0
- Child:
- 54:1ca4e748e098
diff -r 05a8e919ddb0 -r 73565a3ef5c5 main.cpp --- a/main.cpp Wed Apr 15 23:56:52 2015 +0000 +++ b/main.cpp Thu Apr 16 00:07:27 2015 +0000 @@ -332,7 +332,7 @@ uint32_t angle1 = turnSensor.getAngleUnsigned(); // 1000 encoder ticks - const uint32_t lookAheadAmount = 2000 / logSpacing; + const uint32_t lookAheadAmount = 4000 / logSpacing; // Figure out how far away the next turn is. uint32_t i = logIndex; @@ -386,11 +386,11 @@ if (onLongStraightPart()) { speed = 1200; - led3 = 1; + led4 = 1; } else { - led3 = 0; + led4 = 0; } @@ -399,8 +399,8 @@ if (foundStart()) { // Another lap has been completed! - lapsCompleted = 1; - led4 = lapsCompleted & 1; + lapsCompleted += 1; + led3 = lapsCompleted & 1; reckoner.reset(); turnSensor.reset();