I am trying to understand this rotary encoder I have, but it makes no sense to me.
I am using this rotary encoder: https://www.amazon.com/gp/product/B07DM2YMT4/
CYT1100 aka CY110 aka EC11
I am using this wiring: https://i.imgur.com/G1FzH13.png
P2 is the "push button" and it gives continuity when pressed.
I am using a knock off arduino nano and this is my simple script:
#define PIN_CLK 2
void setup()
{
Serial.begin(9600);
pinMode(PIN_CLK, INPUT);
}
void loop()
{
auto val = digitalRead(PIN_CLK);
Serial.println("CLK:" + String(val));
}
Where PIN_CLK is connected to A (DW) or B (CLK) in the diagram.
My expectation is that A and B should be either a constant HIGH or LOW depending on where the brushes are internally. Not switching to HIGH or LOW for a moment and then returning to what it was before.
When I check them with my multimeter, they are both always 5v (when its not making loose contact on the breadboard).
The serial plotter says its switching between HIGH and LOW repeated:
https://i.imgur.com/Tks5O9x.png
Same with the Serial monitor:
https://i.imgur.com/BtwZvWg.png
When I spin the encoder, it gives me gaps of LOW in the output like this:
https://i.imgur.com/Ek7ivGT.png
If I hold my index and thumb against P1 (5v) and A (CLK) while spinning the encoder. I get constant stream of HIGH with a LOW on every notch spin:
https://i.imgur.com/JwgMOBa.png
Can someone explain this behavior and how this encoder is suppose to work?
Edit: I tried this schematic:
https://i.imgur.com/xaHbOsm.png
Whenever I turn the encoder. The LED blinks for a few milliseconds. Then turns off.
Is it suppose to stay solid depending on the 2 bit states?
Edit2: If I turn it extremely slowly. It turns the leds on in the order of left right or right left depending on the direction.
So the led diagram above works, but its weird to me.