encoder.tick(); // just call tick() to check the state. attachInterrupt(digitalPinToInterrupt(PIN_ENCODER_A), checkPosition, CHANGE); attachInterrupt ...