Quadrature encoder interface library.
Dependents: NavigationTest_ NavigationTest theRobotNEW theRobot ... more
Fork of QEI by
Revision 1:6ae719026b06, committed 2014-03-15
- Comitter:
- Fairy_Paolina
- Date:
- Sat Mar 15 22:36:26 2014 +0000
- Parent:
- 0:5c2ad81551aa
- Commit message:
- revise 3/15; ;
Changed in this revision
QEI.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5c2ad81551aa -r 6ae719026b06 QEI.cpp --- a/QEI.cpp Thu Sep 02 16:48:55 2010 +0000 +++ b/QEI.cpp Sat Mar 15 22:36:26 2014 +0000 @@ -251,6 +251,7 @@ (prevState_ == 0x0 && currState_ == 0x3)) { pulses_++; + if(pulses_==pulsesPerRev_) revolutions_++; } //10->01->10->01 is clockwise rotation or "backward". @@ -258,6 +259,7 @@ (prevState_ == 0x1 && currState_ == 0x2)) { pulses_--; + if(pulses_==pulsesPerRev_) revolutions_--; } @@ -274,6 +276,7 @@ } pulses_ -= change; + } }