David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
Diff: main.cpp
- Revision:
- 51:b9f7243609d4
- Parent:
- 50:517c0f0e621f
- Child:
- 52:05a8e919ddb0
diff -r 517c0f0e621f -r b9f7243609d4 main.cpp --- a/main.cpp Wed Apr 15 22:53:33 2015 +0000 +++ b/main.cpp Wed Apr 15 23:01:39 2015 +0000 @@ -307,10 +307,11 @@ bool foundStart() { - static int16_t lastX = 0; - return lastX < 0 && reckoner.x >= 0 && abs(reckoner.y) < (85 << 16) && + static int32_t lastX = 0; + bool result = lastX < 0 && reckoner.x >= 0 && abs(reckoner.y) < (85 << 16) && totalEncoderCounts > 10000 && abs(turnSensor.getAngle()) < turnAngle1 * 30; lastX = reckoner.x; + return result; } void followLineSmart()