Quadrature Encoder always returns constant value even if the shaft is rotating.

I’m using PROS IDE to write a program that would return the value from a quadrature encoder (to test if the encoder is working). In order to test, I just manually rotate the central portion of the encoder that fits into a shaft. However, the value returned is always 2. I tried changing the ports and also reversing the ports. On reversing the ports, I get the value -2 but the value never changes even though the encoder wheel is rotating. Here are snapshots of the code. Is there something wrong in what I’m doing?


Nush - I do not see any errors in your code. With that, it sounds like you have a bad quadrature encoder. Have tried testing this with a different encoder?

Thanks for the reply. Yes, I tried with the two encoders that are part of the 2-pack sensor, provided by Vex ( http://www.vexrobotics.com/276-2156.html). With both, I was getting the same result.

I am currently having the same struggle as you, except mine always returns 0. To be honest I’m just going to write my own methods and structure for the encoder, which truly isn’t that hard.

However, I will go through the motions of checking firmware and such.

I was able to get my encoders working properly. The issue was my batteries were drastically low during testing. To my surprise, fresh batteries did the trick. I did not know that these sensors were so reliant on battery power.

So the digital pins require a minimum voltage to be read as high. It is probably something similar to arduino mega which is 3.3V out of 5V.