David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
main.cpp
- Committer:
- DavidEGrayson
- Date:
- 2014-02-22
- Revision:
- 8:78b1ff957cba
- Parent:
- 7:85b8b5acfb22
- Child:
- 9:9734347b5756
File content as of revision 8:78b1ff957cba:
#include <mbed.h> #include <Pacer.h> #include "motors.h" #include "encoders.h" #include "pc_serial.h" #include "leds.h" int main() { pc.baud(115200); // Enable pull-ups on encoder pins and give them a chance to settle. encoders_init(); motors_init(); // Test routines motors_test(); encoders_test(); Pacer reportPacer(500000); Pacer blinkPacer(200000); while(1) { while(encoderBuffer.hasEvents()) { PololuEncoderEvent event = encoderBuffer.readEvent(); } if(reportPacer.pace()) { led2 = 1; pc.printf("%8d %8d\n", encoder1.getCount(), encoder2.getCount()); led2 = 0; } if (blinkPacer.pace()) { led1 = !led1; } } }