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 Servo Motordriver SDFileSystem
Diff: HallEffectEncoder.h
- Revision:
- 2:baa00f631c7e
- Child:
- 4:067fefe01204
diff -r 40d2fd0b99e6 -r baa00f631c7e HallEffectEncoder.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HallEffectEncoder.h	Tue Apr 14 19:30:37 2020 +0000
@@ -0,0 +1,40 @@
+#ifndef HALL_EFFECT_ENCODER_H
+#define HALL_EFFECT_ENCODER_H
+
+#include "mbed.h"
+
+class HallEffectEncoder {
+    
+public:
+
+    HallEffectEncoder(PinName pin, float update_speed);
+    
+    int   getCount();    // get the count of the encoder
+    void  reset();       // reset the count to 0
+    float getDist();     // get the distance 
+    float getSpeed();    // get the speed of the wheel
+    void  updateSpeed(); // updates the speed of the wheel
+
+private:
+    
+    InterruptIn _encoder;       //Input Pin
+    
+    /* Ticker Speed Update*/
+    float ticker_update_speed;  //Update Period
+    Ticker _speed_ticker;
+    
+    // Pole transitions callback
+    void callback_transition();
+    
+    //Internals
+    int   count; // Transitions count
+    float speed; // Speed is in cm / s
+    
+
+    
+};
+
+
+
+
+#endif
\ No newline at end of file