-- download at MT.QZX.COM (tick.lua) local o = "a" -- output local i = "c" -- lever local th = 0.1 -- on for 0.1s local tl = 1 -- off for 1s local ticks = 10 -- tick 10 times each time lever is reset to on if event.type == "on" and pin[i] then mem.t = ticks port[o] = true interrupt(th, "lo") elseif pin[i] then if event.iid == "hi" then port[o] = true interrupt(th, "lo") else port[o] = false mem.t = mem.t - 1 if mem.t > 0 then interrupt(tl, "hi") end end elseif event.type == "off" then port[o] = false end