Connecting the Hardware
Schematic
Connect the rotary encoder as shown below.
The microcontroller pins you connect to should agree with
rotenc.c. I used PCINT8
(PC0
) and PCINT9
(PC1
) for
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.