Counter for hardware with Arduino due to use an encoder