I have an old treadmill which has a reed switch by default to "measure the speed". It's like shown in the attachment.
As you know, reed switches have very poor resolution, i.e, a pulse per revolution. And, at low speeds, this is terrible. But I'm curious about how I can create a code with STM32 to effectively measure the speed without a time-consuming routine. I know there are better sensors with better resolution, but this time I would like to take advantage of the structure of the machine, instead of adding another sensor.
Interrupts services, or what?
I would appreciate any ideas.