-- download at MT.QZX.COM (multiport-pulse-on-rising-edge.lua) local i1 = "b" -- input 1 local i2 = "d" -- input 2 local o1 = "a" -- output 1 pulse local o2 = "c" -- output 2 pulse local th = 5 -- 5s pulse length if event.iid == "pulse" then port[o1] = false port[o2] = false mem.o = false elseif event.type == "on" and not mem.o and ((pin[i1] and not mem.s1) or (pin[i2] and not mem.s2)) then mem.s1 = pin[i1] mem.s2 = pin[i2] interrupt(th, "pulse") port[o1] = true port[o2] = true mem.o = true elseif event.type == "off" then if not pin[i1] and mem.s1 then mem.s1 = pin[i1] end if not pin[i2] and mem.s2 then mem.s2 = pin[i2] end end