The HW-040 rotary encoder is a 360-degree rotary input device (i.e. a control knob) that provides an indication of how much the knob has been rotated AND which direction it is rotating in.
It is a great device for stepper and servo motor control. You can also use it to control devices like digital potentiometers.
The HW-040 rotary encoder has a fixed number of 20 positions per revolution. These positions are felt as small “clicks” when you turn the encoder. Inside the encoder, there are two switches. One switch connects pin A to pin C and the other switch connects pin B to C. In each encoder position, both switches are either opened or closed. Each click causes these switches to change states. If both switches are closed, turning the encoder either clockwise or counterclockwise one position will cause both switches to open. If both switches are open, turning the encoder either clockwise or counterclockwise one position will cause both switches to close.