This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

universal MQTT / Timer / Localbus event loop
#6
if i want to stop a timer from the resident script callback function how can i realize this? 
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
Reply


Messages In This Thread
RE: universal MQTT / Timer / Localbus event loop - by benanderson_475 - 23.09.2020, 01:26

Forum Jump: