I need to run a PWM output for a predefined number of pulses. The frequency is generally around 50 Hz. The duty cycle can be anywhere form 0 to 100 %.
I'm currently using the Teensy pulsed output (https://www.pjrc.com/teensy/td_pulse.html) functionally to generate a PWM output. This is working well.
My current plan is to use the FreqMeasureMulti (https://github.com/PaulStoffregen/FreqMeasureMulti) library to detect and count pulses (on the falling edge) and then disable the PWM output after a set number of pulses. I think this will work except when the duty cycle is high and an extra pulse may be generated before the previous pulse is detected. Is there an alternative solution?
I'm currently using the Teensy pulsed output (https://www.pjrc.com/teensy/td_pulse.html) functionally to generate a PWM output. This is working well.
My current plan is to use the FreqMeasureMulti (https://github.com/PaulStoffregen/FreqMeasureMulti) library to detect and count pulses (on the falling edge) and then disable the PWM output after a set number of pulses. I think this will work except when the duty cycle is high and an extra pulse may be generated before the previous pulse is detected. Is there an alternative solution?