Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local server = 27
- local monitor = 26
- local m = peripheral.wrap("front")
- local data
- local canStore
- local max
- local compID
- function closeNet()
- rednet.close("top")
- end
- function openNet()
- closeNet()
- rednet.open("top")
- end
- function getData()
- data = m.get()
- canStore = data["Can Store Energy"]
- max = data["Full Energy"]
- compID = os.getComputerID()
- end
- function detect()
- getData()
- openNet()
- if canStore then
- print("Energy Cell is not yet charged.")
- rednet.send(server,"Charging")
- rednet.send(monitor,"Charging")
- sleep(5)
- elseif max then
- print("Energy Cell is fully charged.")
- rednet.send(server,"Full")
- rednet.send(monitor, "Full")
- sleep(10)
- else
- print("There is no Energy Cell to read.")
- rednet.send(server,"Absent")
- rednet.send(monitor,"Absent")
- sleep(5)
- end
- end
- while true do
- detect()
- end
Advertisement
Add Comment
Please, Sign In to add comment