I'm trying to work out how to pulse detect on a PWM waveform, and need to detect when there are no pulses, when pulses are a certain length and when pulses get shorter than that.
The signal is active low, so it sits at 5V when there are no pulses.
When the pulses start, they drop to about 3V.
My main concern is this. The duty cycle starts at about 50% then moves in steps till it's 100%, or 0% as it's active low.
So I can check for no pulses initially, then measure them when they arrive, but what is pulseIn going to do when is it just a steady low level, with no edges to detect ?
I'm thinking along the lines of a flag that says there were pulses, and they were getting shorter, so the signal is now fully active, and then negate that when the pulses return and do a similar thing going the other way.
The wavelength is 80mS, when there are pulses present.
Plan B is to try and use the ADC to sample the pulses, as that will cope with the steady states at 0% and 100% duty cycle, but I'm not sure how well it will cope with the pulses.
Is there a tried and tested methodology for this sort of situation ?