Solution needed for counting pulse inputs WITHOUT using Intterupts

We’re also assuming OP’s pulses are clean.
It may be necessary to filter/cleanup the pulses to avoid miscounting stray edges