David's dead reckoning code for the LVBots competition on March 6th. Uses the mbed LPC1768, DRV8835, QTR-3RC, and two DC motors with encoders.
Dependencies: PololuEncoder Pacer mbed GeneralDebouncer
Diff: line_sensors.cpp
- Revision:
- 40:6fa672be85ec
- Parent:
- 32:83a13b06093c
--- a/line_sensors.cpp Thu Jul 25 02:11:25 2019 +0000 +++ b/line_sensors.cpp Thu Jul 25 02:53:34 2019 +0000 @@ -1,14 +1,5 @@ #include "line_sensors.h" - -/** -AnalogIn lineSensorsAnalog[LINE_SENSOR_COUNT] = { - AnalogIn(p20), // brown wire, left-most sensor - AnalogIn(p19), // orange wire, middle sensor - AnalogIn(p17), // blue wire, right-most sensor -}; // TODO: remove -**/ - DigitalInOut lineSensorsDigital[LINE_SENSOR_COUNT] = { DigitalInOut(p18), // white wire, left-most sensor DigitalInOut(p19), // orange wire, middle sensor @@ -46,25 +37,3 @@ } } } - - -/** -uint16_t analogReadWithFilter(AnalogIn * input) -{ - uint16_t readings[3]; - for(uint8_t i = 0; i < 3; i++) - { - readings[i] = input->read_u16(); - } - - if (readings[0] <= readings[1] && readings[0] >= readings[2]) - { - return readings[0]; - } - if (readings[1] <= readings[0] && readings[1] >= readings[2]) - { - return readings[1]; - } - return readings[2]; -} -**/ \ No newline at end of file