A rotary encoder has a number defined positions for a complete revolution (a turn of 360 degrees). You can feel a click at each step when turning the cursor of the potentiometer.
Here we don't measure the value of a variable resistance, we measure logical signals on two digital pins of the Arduino.
For example, when one is in a position, A and B have the same logical level ( 0 or 1 ).
If you turn clockwise, the status signal A changes before B, and conversely when we turn in the other direction.
In this project, we'll display the angular positions on the serial monitor.
ConnectionsRotary encoder --> Arduino
CLK --> Digital 4
DT --> Digital 5
SW --> Digital 0
+ --> 5V
GND --> GND
Comments
Please log in or sign up to comment.