18.03.2025, 09:58
I have flood sensor witch sends me an alarm in case of flood. When the alarm state is triggered i need to make a light blink constantly until the alarm stops.
I created an event-based script triggered by the state of the sensor and inside I created a while loop inside:
Now it works but it easily overloads the CPU pretty easily. Is there a better way to do this?
I created an event-based script triggered by the state of the sensor and inside I created a while loop inside:
Code:
while grp.getvalue("stato sensore") do
grp.write("luce", true)
os.sleep(1)
grp.write("luce", false)
os.sleep(1)
end
Now it works but it easily overloads the CPU pretty easily. Is there a better way to do this?