David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
encoders.cpp
- Committer:
- DavidEGrayson
- Date:
- 2015-04-16
- Revision:
- 57:99bec7fab454
- Parent:
- 12:835a4d24ae3b
File content as of revision 57:99bec7fab454:
#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, ENCODER_LEFT);
PololuEncoder encoderRight(encoderPinRightA, encoderPinRightB, &encoderBuffer, ENCODER_RIGHT);
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();
}
David Grayson
