That's expected behaviour, the counter is triggered by rising edge of the input signal and the output is updated only after measurement, which means no signal, no updates. You can implement a timeout, which will set the frequency to zero if there wasn't an update in more than gate time plus, let's say, 50% milliseconds. To do it, on each update save the update time (using ticks_ms()) and at the end of the while loop check if the difference between current time and update time (use ticks_diff() to calcule it) is larger than the timeout, if it is, set frequency to 0.
Statistics: Posted by horuable — Wed Jul 02, 2025 7:35 am