Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: PololuEncoder Pacer mbed GeneralDebouncer
encoders.cpp
- Committer:
- DavidEGrayson
- Date:
- 2019-07-25
- Revision:
- 39:b19dfc5d4d4b
- Parent:
- 12:835a4d24ae3b
File content as of revision 39:b19dfc5d4d4b:
#include "encoders.h"
const PinName encoderPinLeftA = p6, // White wire
encoderPinLeftB = p7, // Yellow wire
encoderPinRightA = p30, // Yellow wire
encoderPinRightB = p29; // White 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();
}