I have a rotary encoder, similar to that one:
http://hacks.ayars.org/2009/12/using-quadrature-encoder-rotary-switch.htmlI have hooked it up to my stationary bike, with the code similar to the one in the link.
However, it does not work properly - the count is not reliable at all, the direction is often wrong. For example, if I turn the pedals in one direction, the counter does not go up steadily, but seems to alternate between some values... (e.g. 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2...).
First question is: is the encoder suitable at all for my purpose? The typical speed would be four full turns per second, maybe it is just too much for it?
Second question: what might be wrong with the code? Why is it alternating the value?