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: mbed mbed-rtos Motor LSM9DS1_Library_cal X_NUCLEO_53L0A1
Encoder.cpp
- Committer:
- rpatelpj
- Date:
- 2019-04-23
- Revision:
- 11:531208aca075
File content as of revision 11:531208aca075:
#include "Encoder.h"
Encoder::Encoder(PinName trig): _trig(trig) {
_trig.mode(PullUp);
_trig.rise(this, &Encoder::increment);
count = 0;
}
Encoder::~Encoder() {
delete &_trig;
}
int Encoder::read() {
return count;
}
void Encoder::reset() {
count = 0;
}
void Encoder::increment() {
count = count + 1;
}
