Incremental rotary encoder class

Dependents:   PWM_LED_Lights

Revision:
0:b245c23a1c44
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RotaryEncoder.h	Tue Sep 21 16:46:09 2021 +0000
@@ -0,0 +1,23 @@
+#ifndef ROTARYENCODER_H
+#define ROTARYENCODER_H
+
+#include "mbed.h"
+
+class RotaryEncoder{
+    public:
+        RotaryEncoder(PinName pEncoderA, PinName pEncoderB);
+        void        SetCounter(float setValue);
+        void        Init(float startValue);
+        void        Count();
+        bool        Enable;
+        float       Value;
+        float       LastState;
+    private:
+        int         aState;
+        int         aLastState;
+        InterruptIn encoderA;
+        DigitalIn   encoderB;
+        Timer       debounce;
+};
+
+#endif
\ No newline at end of file