Rock solid rotary encoder C++ code without need for hardware debounce.
Interrupt driven or polling. Multiple encoders supported.
This code is for the Arduino environment, but is easily adopted to any environment as long as you have the ability to read digital pins, and for the interrupt version, the ability to attach an interrupt to a pin.