Replies: 1 comment 2 replies
-
|
Intersting idea, I would not do that in python on the Pi though for a few reasons
An improved solution would be to count the pulses on something like an esp32 or arduino then get the results from that. To answer your original question in the current release you cant do this as the module only runs when the flow does. In the next release there is a 'server' that you could add the code to that runs all of the time Alex |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be great to have a module for a wind sensor available, so I tried to write one. There are sensors that generates pulses/edges on each turn. To measure the wind speed it would be great to count the number of pulses/edges between 2 periodic calls of the module and get the time between these 2 calls.
I've managed to add an event counter function, however this only measures the pulses when the module is active. Is there a way to have the event counter active all the time?
def pulse_callback():
global pulse_count, last_pulse_time
with lock:
pulse_count += 1
last_pulse_time = time.time()
def windspeed(params, event):
btn = Button(WIND_PIN,bounce_time=DEBOUNCE_MS)
btn.when_pressed = pulse_callback
Beta Was this translation helpful? Give feedback.
All reactions