Counter for hardware with Arduino due to use an encoder

Hi there @Gabriel_MX

You can do what you want with library tc_lib (GitHub - antodom/tc_lib: This is a library to take advantage of different functionalities available on Timer Counter (TC) modules in Arduino Due's Atmel ATSAM3X8E microcontrollers). Have a look to example capture_test.ino, it gives you the instantaneous duty and period of a digital signal. In your problem the signal would be coming from your encoder. The period given would be the duration of an encoder tick, so 1/period will give you the velocity in ticks per second.

I hope it helps.