N20 Motor Rotary Encoder Counting Problem

I suggest that you start with a program that only controls the motor (no EEPROM and no IR) to keep things as simple as possible until you figure out how to control the motor.

I don't understand why you would have a function called setEncoderDirection(). In my mind you GET data from an encoder.

...R