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: test.cpp
- Revision:
- 29:cfcf08d8ac79
- Parent:
- 28:4374035df5e0
- Child:
- 30:84be2d602dc0
--- a/test.cpp Sat Mar 01 03:13:57 2014 +0000 +++ b/test.cpp Tue Mar 04 00:46:18 2014 +0000 @@ -16,10 +16,49 @@ void __attribute__((noreturn)) infiniteReckonerReportLoop(); void printBar(const char * name, uint16_t adcResult); +void testAnalogReadWithFilter() +{ + AnalogIn testInput(p18); + Pacer reportPacer(1000000); + uint32_t badCount = 0, goodCount = 0; + while(1) + { + uint16_t reading = analogReadWithFilter(&testInput); + if(reading > 100) + { + badCount += 1; + pc.printf("f %5d %11d %11d\r\n", reading, badCount, goodCount); + } + else + { + goodCount += 1; + } + + if (reportPacer.pace()) + { + pc.printf("Hello\r\n"); + } + } +} + void testAnalog() { AnalogIn testInput(p18); + DigitalOut pin20(p20); + DigitalOut pin19(p19); + //DigitalOut pin18(p18); + DigitalOut pin17(p17); + DigitalOut pin16(p16); + DigitalOut pin15(p15); + + pin20 = 0; + pin19 = 0; + //pin18 = 0; + pin17 = 0; + pin16 = 0; + pin15 = 0; + uint32_t badCount = 0, goodCount = 0; Pacer reportPacer(1000000);