David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
encoders.cpp
- Committer:
- DavidEGrayson
- Date:
- 2014-02-22
- Revision:
- 8:78b1ff957cba
- Child:
- 9:9734347b5756
File content as of revision 8:78b1ff957cba:
#include "encoders.h" const PinName encoderPin1A = p6, encoderPin1B = p7, encoderPin2A = p8, encoderPin2B = p9; PololuEncoderBuffer encoderBuffer; PololuEncoder encoder1(encoderPin1A, encoderPin1B, &encoderBuffer, ENCODER1); PololuEncoder encoder2(encoderPin2A, encoderPin2B, &encoderBuffer, ENCODER2); void encoders_init() { DigitalIn(encoderPin1A).mode(PullUp); DigitalIn(encoderPin1B).mode(PullUp); DigitalIn(encoderPin2A).mode(PullUp); DigitalIn(encoderPin2B).mode(PullUp); wait_us(50); encoder1.init(); encoder2.init(); }