ryan fish / QEI

Dependents:  

Fork of QEI by -deleted-

Files at this revision

API Documentation at this revision

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.