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/
This Class handles a rotary encoder with mechanical switches and an integrated pushbutton It uses two pins, one creating an interrupt on change.
Rotation direction is determined by checking the state of the other pin. Additionally a pushbutton switch is detected
Operating the encoder changes an internal integer value that can be read by Get() or the operator int() functions. A new value can be set by Set(value) or opperator=.
Autor: Thomas Raab (Raabinator) Extended by Karl Zweimueller (charly)
Dent steady point ! ! ! +-----+ +-----+ pinA (interrupt) | | | | --+ +-----+ +--- +-----+ +-----+ pinB | | | | ----+ +-----+ +- --> C.W CW: increases position value CCW: decreases position value
09. Nov. 2010 First version published Thomas Raab raabinator 26.11.2010 extended by charly - pushbutton, pullmode, debounce, callback-system Feb2011 Changes InterruptIn to PinDetect which does the debounce of mechanical switches Mar2020 Configurable detection of rise/fall events to account for different types of encoders (half as much dent points)
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
You do not have the correct permissions to perform this operation.