I thought incorporating a rotary switch into my next project would be a simple matter. Not really! Gray code, quadrature phase shift and switch debounce studied, and I'm still nowhere near a working switch.
...
https://www.youtube.com/watch?v=9Xm05_2AD8E