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
encoders.cpp
- Committer:
- DavidEGrayson
- Date:
- 2014-02-22
- Revision:
- 10:e4dd36148539
- Parent:
- 9:9734347b5756
- Child:
- 12:835a4d24ae3b
File content as of revision 10:e4dd36148539:
#include "encoders.h" const PinName encoderPinLeftA = p6, // Gray wire encoderPinLeftB = p7, // White wire encoderPinRightA = p30, // White wire encoderPinRightB = p29; // Gray wire PololuEncoderBuffer encoderBuffer; PololuEncoder encoderLeft(encoderPinLeftA, encoderPinLeftB, &encoderBuffer, ENCODER1); PololuEncoder encoderRight(encoderPinRightA, encoderPinRightB, &encoderBuffer, ENCODER2); void encodersInit() { DigitalIn(encoderPinLeftA).mode(PullNone); DigitalIn(encoderPinLeftB).mode(PullNone); DigitalIn(encoderPinRightA).mode(PullNone); DigitalIn(encoderPinRightB).mode(PullNone); wait_us(50); encoderLeft.init(); encoderRight.init(); }