23.09.2020, 01:26
(This post was last modified: 23.09.2020, 01:34 by benanderson_475.)
if i want to stop a timer from the resident script callback function how can i realize this?
Many Thanks
Many Thanks
Code:
function on_timer2()
if (some condition) then
-- stop Timer here
end
end
function setup()
local lp = loop.get()
-- use one or more of the below in any combination
-- mqtt client with callback function to receive messages
-- store mqtt.client to local variable if you want to publish messages later
local mqtt = loop.create_mqtt(mqtt_cfg, mqtt_onmessage)
-- add 'groupread = read_callback' to add read callback handler
local bus = loop.create_localbus({ groupwrite = localbus_onmessage })
-- timer that fires callback every 10 seconds, period can be a fraction of a second
local timer = loop.create_timer(10, on_timer)
local timer = loop.create_timer(10, on_timer2)
-- add all workers to our loop
lp:add(mqtt)
lp:add(bus)
lp:add(timer)
end