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.
Fork of QEI by
Revision 2:c10e8ecc2e87, committed 2013-11-26
- Comitter:
- calamaridudeman
- Date:
- Tue Nov 26 04:31:41 2013 +0000
- Parent:
- 1:865d5b989ec4
- Commit message:
- don't worry about it
Changed in this revision
QEI.cpp | Show annotated file Show diff for this revision Revisions of this file |
QEI.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/QEI.cpp Tue Nov 19 20:41:35 2013 +0000 +++ b/QEI.cpp Tue Nov 26 04:31:41 2013 +0000 @@ -185,6 +185,12 @@ } +float QEI::getAngle(void) { + + return pulses_*2*3.1415926/pulsesPerRev_; + +} + int QEI::getRevolutions(void) { return revolutions_;
--- a/QEI.h Tue Nov 19 20:41:35 2013 +0000 +++ b/QEI.h Tue Nov 26 04:31:41 2013 +0000 @@ -200,6 +200,13 @@ * @return Number of pulses which have occured. */ int getPulses(void); + + /** + * Read the angle of the encoder in radians + * + * @return Angle in radians + */ + float getAngle(void); /** * Read the number of revolutions recorded by the encoder on the index channel.