Hello, I am trying to find out how to take a step signal that would usually go to a stepper driver but instead use it as an input to a pro micro 32u4 to count how fast the pulsing is. Should I use Interrupt or PulseIn? any help is appreciated. Jamie
pulseIn will only give you the pulse width at the time you call it. If the pulses are always a consistent width and the stepper does not employ ramp up/down when starting and stopping then this would probably be fine. Interrupts could continually read the pulse width and maybe average it or divide time/pulses to get average pulse width that can be read at any time in the main code.
Some pins route straight into a counter module and can be set up to automatically count, but I think on the Uno there's only one - the Mega has a few more.
Its probably most flexible to dedicate an interrupt input to this, or a pin change interrupt (which increases the choice of pins).