Class mRotaryEncoder for mechanical incremental rotary encoders with pushbuttons. Use debouncing and callback-functions for rotation and pressing of button. This version is for old mbed. New version for mbed-os see https://os.mbed.com/users/charly/code/mRotaryEncoder-os/

Dependencies:   PinDetect

Dependents:   SimplePIDBot FinalProgram VS1053Player SPK-DVIMXR ... more

Revision:
2:f99ac9745a2c
Parent:
0:562943b05e99
Child:
3:39c2fc4482be
--- a/mRotaryEncoder.cpp	Mon Nov 29 21:38:17 2010 +0000
+++ b/mRotaryEncoder.cpp	Tue Feb 01 19:43:46 2011 +0000
@@ -15,8 +15,11 @@
     m_pinA->fall(this, &mRotaryEncoder::fall);
 
     // Switch on pinSW
-    m_pinSW = new InterruptIn(pinSW);                 // interrupt on press switch
+    m_pinSW = new PinDetect(pinSW);                 // interrupt on press switch
     m_pinSW->mode(pullMode);
+    
+    m_pinSW->setSampleFrequency(); // Defaults to 20ms.
+
 
     m_position = 0;