RedBot RotaryEncoder

Hi

RedBot RotaryEncoder connected to Arduino is not working My code, as described in official example:

I can only read analog input, but they said it gives digital output. Why?

Maybe this link could help...

https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-for-redbot/experiment-7-encoder

They use 'long' for the integer type...

long lCount = 0;
long rCount = 0;

Maybe in your void setup() area

you could include something like:

encoder.clearEnc(BOTH); // clear the encoder count

I assume that clearEnc will set (to zero) some kind of internal counter that keeps internally changing the number of LEFT-ticks, and the number of RIGHT-ticks ----- and these user variables lCount and rCount can be used to access (get) those internal LEFT-tick and RIGHT-tick values.