-- download at MT.QZX.COM (clock-until.lua) local o = "a" -- output local i = "c" -- pulse to start or restart local t = 600 -- run for 600s and then turn off until next pulse local th = 1 -- on for 1s local tl = 1 -- off for 1s if event.type == "program" or event.iid == "stop" then mem.r = false elseif event.type == "on" and pin[i] then mem.r = true interrupt(t, "stop") elseif event.type == "on" and mem.r then port[o] = true interrupt(th, "lo") elseif mem.r then if event.iid == "hi" then port[o] = true interrupt(th, "lo") else port[o] = false interrupt(tl, "hi") end elseif event.type == "off" then port[o] = false end