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.
Diff: RotaryEncoder.h
- 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