Counting raising edges per second
I have a device which outputs a sort of PWM signal, better a pulse per count. I'd like to count the rising edges pers second and the ater transmit that value via BTLE (for now: just print the value every second).
I've read that micropython on the ESP32 cannot do hardware interrupts - true?
Is there a proven way to count rising edges per sond on the WiPy?
robert-hh last edited by
@cts WiPy supports a Pin interrupt, which can be triggered with the rising edge. Look in the documentation for "Pin". And is has a timer module, which could be used for setting the gate time. Look in the documentation at "Timer". However, the precision and speed is very limited. Without testing, I would assume that it works reliably only for frequencies below 1 kHz, with a uncertainty of the gate time of about 1 ms. I