As the title says... Chat on...

User avatar
By jas
#38291 I can use the following code to set tmr.alarm(); for 1 hour.
It does not seem to be capable of going above 3600000 milli-seconds (ie 1 hr).

I need 2hr, 3hr and 4 hr intervals.

..it's for turning the heating onto manual for these time intervals while out of the house..

Can anyone suggest how to do this?

Thank you.



Code: Select allfunction writeled1low ()
         gpio.write(led1, gpio.HIGH);
         gpio.write(led2, gpio.HIGH);
end

local _on,_off = "",""

        if(_GET.pin == "1hrOn")then
            gpio.write(led1, gpio.LOW);
            gpio.write(led2, gpio.LOW);
            tmr.stop(1);
            tmr.alarm(1, 3600000, 1, writeled1low);

end
User avatar
By xtal
#38577 this might work..... :mrgreen:
Code: Select allfunction Hour1()
   do_next = Hour2
    < do hour1 stuff>
  collectgarbage()
end
function Hour2()
   do_next = Hour3
    < do hour3 stuff>
  collectgarbage()
end
function Hour3()
   do_next = Hour4
    < do hour3 stuff>
  collectgarbage()
end
function Hour4()
   do_next = whatever
   timer off ----------
    < do hour4 stuff>
  collectgarbage()
end
-- MAIN ----------------------------------------------------------
do_next = Hour1
tmr.alarm(0,36000000, function(), do_next(), end)