I tried to read data from an angled rotary encoder with my arduino UNO. I desoldered it and tried to find a datasheet but in vain. I attached a screenshot of the oscilloscope (phase A and B of the encoder). I tried several codes I found on the arduino website but no one worked. I assumed the pinout of the rotary encoder is the one I attached. The last wiring and code I tried is this one.
I'm not sure what to make of your oscilloscope trace which makes little sense in itself as it shows capacitive discharges which would correspond to using pull-downs, not the pull-ups you show in your diagram, and I cannot see how a quadrature encoder could possibly be mis-wired to give that pattern.
.
Your first link has nothing whatsoever to do with rotary encoders.
And your code is simply nonsensical I am afraid. To use interrupts - which is in this case a very bad idea - you must specify which pins will be generating the interrupt - you seem to be looking for one on pin 0 - I think!
And you cannot put things like Serial.println in interrupts.
And attempting to use R-C debouncing on a rotary encoder is another very bad idea!
Thank you for your answer. I don't know why but I was thinking the knob on this board was a rotary encoder with a switch function. What do you think it is ? It has 5 pins and there is a switch at the start of the rotation.
ayubobo:
I don't know why but I was thinking the knob on this board was a rotary encoder with a switch function. What do you think it is ? It has 5 pins and there is a switch at the start of the rotation.
It is called a switch-potentiometer. The switch is just a power switch to turn everything off.