This library uses a timer on the Arduino Uno R4 for reading a rotary encoder.
Encoder library for Arduino Uno R4