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:
- 39:b19dfc5d4d4b
- Parent:
- 37:23000a47ed2b
- Child:
- 40:6fa672be85ec
diff -r 5e93a479c244 -r b19dfc5d4d4b test.cpp --- a/test.cpp Thu Mar 13 17:49:43 2014 +0000 +++ b/test.cpp Thu Jul 25 02:11:25 2019 +0000 @@ -404,6 +404,26 @@ } } +void testMotorSpeed() +{ + led1 = 1; + motorsSpeedSet(400, 400); + wait_ms(4000); + uint32_t left = encoderLeft.getCount(); + uint32_t right = encoderRight.getCount(); + motorsSpeedSet(0, 0); + Pacer reportPacer(500000); + while (1) + { + if (reportPacer.pace()) + { + led2 = 1; + pc.printf("%8d %8d\r\n", left, right); + led2 = 0; + } + } +} + void testEncoders() { Pacer reportPacer(500000);