Try this sketch to test the encoder counts at different speeds.
#include <Encoder.h>
// Change these pin numbers to the pins connected to your encoder.
// Best Performance: both pins have interrupt capability
// Good Performance: only the first pin has interrupt capability
// Low Performance: neither pin has interrupt capability
Encoder knobLeft(0, 1);
Encoder knobRight(2, 3);
// avoid using pins with LEDs attached
void setup() {
Serial.begin(115200);
Serial.println("TwoKnobs Encoder Test:");
}
void loop() {
int newLeft, newRight;
newLeft = knobLeft.read();
newRight = knobRight.read();
if (newLeft != 0 || newRight != 0) {
Serial.print("Left = ");
Serial.print(newLeft);
Serial.print(", Right = ");
Serial.print(newRight);
Serial.println();
knobLeft.write(0);
knobRight.write(0);
}
delay(50);
}