David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
Diff: line_tracker.h
- Revision:
- 21:c279c6a83671
- Child:
- 22:44c032e59ff5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/line_tracker.h Thu Feb 27 23:20:34 2014 +0000 @@ -0,0 +1,28 @@ +#pragma once + +#include "line_sensors.h" + +class LineTracker +{ + public: + LineTracker(); + + void updateCalibration(); + + void read(); + bool getLineVisible(); + uint16_t getLinePosition(); + + uint16_t rawValues[LINE_SENSOR_COUNT]; + uint16_t calibratedValues[LINE_SENSOR_COUNT]; + uint16_t calibratedMaximum[LINE_SENSOR_COUNT]; + uint16_t calibratedMinimum[LINE_SENSOR_COUNT]; + + private: + void readRawValues(); + void updateCalibratedValues(); + void updateLineStatus(); + + bool lineVisible; + uint16_t linePosition; +};