I am using this rotary encoder library: arduino/libraries/Rotary at master · buxtronix/arduino · GitHub