Figure 2—As you can see, with this circuit you can interface two rotary encoders and up to four optional switches to an AVR microcontroller. Although the microcontroller isn’t shown, note the port lines that enable the interface.