Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = {}
- rednet.open("right")
- local x = {peripheral.find("EnergyMeterRF")}
- print(x)
- for k,v in pairs(x) do
- p[v.getLabel()] = v
- end
- function loadDB()
- local f = fs.open("db", "r")
- db = textutils.unserialize(f.readAll())
- f.close()
- end
- function saveDB()
- local f = fs.open("db", "w")
- f.write(textutils.serialize(db))
- f.close()
- end
- while true do
- e = {}
- for k,v in pairs(p) do
- if not v.isOutputAllowed() then
- e[k] = -1
- v.reset()
- print("out")
- print(v)
- else
- e[k] = v.getCountAndReset()
- end
- end
- rednet.send(33, textutils.serialize(e))
- rednet.send(34, textutils.serialise(e))
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement