A rotary encoder is a type of position sensor used to determine the angular position of a rotating shaft. It generates an electrical signal, either analog or digital, according to the rotational movement (more info).
The firmware counts impulses in the 500 ms interval and sends a positive value for CW rotations and a negative value for CCW rotations. Optionally, the firmware can handle and send an event for a click button.
Output 1 → S1
Output 2 → S2
Input 2 → Key
GND → GND
3.3V → VCC
The image above is an example. You can connect signals to any pins and place them on any input and output. The I2C SCL line should be defined immediately after the “Rotary encoder.”