Help with video game controller using rotary encoder on the Arduino Leonardo

 if (result == DIR_CW) {
    counter++;
    Serial.println(counter);
  } else if (result == DIR_CCW) {
    counter--;
    Serial.println(counter

Don't use Serial.print within an ISR. Set a flag to be acted upon in the main code.

1 Like