Endless encoder with ATmega2560