N20 Motor Rotary Encoder Counting Problem

Please post your code and a circuit diagram. A photograph of a hand drawn circuit will suffice.

A link to the motor/gearbox/encoder would also be useful