Connecting the Hardware
Connect the rotary encoder as shown below.
The microcontroller pins you connect to should agree with
rotenc.c. I used
signals A and B, respectively. (Pins C and D aren’t connected, since
my rotary encoder didn’t have a switch.)
Both microcontroller pins should be enabled as input with an internal pull-up resistor.
Here is what it looks like on my breadboard with a programmer and FTDI Serial-USB cable attached.