Basic Encoder
This is for rotary encoder. For it you will need to download from library manager in Arduino IDE, library Encoder by Paul Stoffregen. You connect two wippers to pins you set in your sketch, 2 and 3 are good since they are interupt pins.
Basic Encoder visits: