-- https://git.tchncs.de/snippets/5606 local channel = "A" local solar = "B" -- connect a solar panel to this port -- must be uppercase if mem.setup == nil then mem.setup = true mem.rtime = 0 mem.time = 0 mem.id = 0 interrupt(1, mem.id) elseif event.type == "off" and event.pin.name == solar then mem.rtime = 0.75849997997284 mem.id = mem.id + 1 interrupt(1, mem.id) elseif event.type == "on" and event.pin.name == solar then mem.rtime = 0.243458 mem.id = mem.id + 1 interrupt(1, mem.id) elseif event.type == "digiline" and event.channel == channel and string.upper(event.msg) == "GET" then digiline_send(channel,mem.rtime) elseif event.type == "interrupt" and event.iid == mem.id then mem.rtime = (mem.rtime + 0.000837499) % 1 mem.id = mem.id + 1 interrupt(1, mem.id) end