A software debouncing class for rotary encoders
Rotary encoders are notoriously difficult to get right.
Although I haven’t used this new encoder class yet, it looks very interesting. From active Teensy forum user Theremingenieur, it allows initialization with upper and/or lower limits.
You can find the code in this thread.