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:
- 4:067fefe01204
- Parent:
- 2:baa00f631c7e
--- a/HallEffectEncoder.h Sat Apr 18 00:57:09 2020 +0000
+++ b/HallEffectEncoder.h Thu Apr 30 00:02:07 2020 +0000
@@ -6,27 +6,28 @@
class HallEffectEncoder {
public:
-
+ //CTOR
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
+ //PUBLIC API
+ float getDist(); // get the distance //WIP has Wheel Diameter encoded
float getSpeed(); // get the speed of the wheel
- void updateSpeed(); // updates the speed of the wheel
+ int getCount(); // get the count of the encoder
+
+ void reset(); // reset the count to 0
-private:
- InterruptIn _encoder; //Input Pin
+private:
+ /* Encoder Input */
+ InterruptIn _encoder; // Input Pin
+ void callback_transition(); // Pole transitions callback
- /* Ticker Speed Update*/
- float ticker_update_speed; //Update Period
+ /* Speed Update Ticker */
+ float ticker_update_speed; // Update Period
Ticker _speed_ticker;
+ void updateSpeed(); // Updates the speed of the wheel
- // Pole transitions callback
- void callback_transition();
-
- //Internals
+ /* Internals */
int count; // Transitions count
float speed; // Speed is in cm / s