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.
src/encoders.cpp
- Committer:
- rwgriffithv
- Date:
- 2018-11-26
- Revision:
- 3:35deb5c21b33
- Parent:
- 0:88c60458332e
File content as of revision 3:35deb5c21b33:
#include "encoders.h" #include "pins.h" #include "globals.h" #include "mbed.h" #include "QEI.h" /*** * Assignment 2 * * Import the QEI in order to have functioning encoders. ***/ QEI wheel_R(ENC_RF, ENC_RB, NC, 624, QEI::X4_ENCODING); QEI wheel_L(ENC_LF, ENC_LB, NC, 624, QEI::X4_ENCODING); /////// // Encoder class implementation /////// Encoder::Encoder() { reset(); } void Encoder::reset() volatile { wheel_R.reset(); wheel_L.reset(); } int Encoder::getPulsesR() volatile { return wheel_R.getPulses(); } int Encoder::getPulsesL() volatile { return wheel_L.getPulses(); } void Encoder::printValues() volatile { pc.printf("R: %d\tL: %d\n", getPulsesR(), getPulsesL()); }