Baguette Boys / Mbed 2 deprecated Billon-Mazgaj__Drawing_Robot

Dependencies:   mbed Servo Motordriver SDFileSystem

Revision:
2:baa00f631c7e
Child:
4:067fefe01204
--- /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