Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("back")
- rednet.open("top")
- data = {}
- function fetchData()
- while true do
- e, id, d,c = os.pullEvent("rednet_message")
- if id == 0 then
- data = textutils.unserialize(d)
- end
- end
- end
- function displayData()
- os.sleep(5)
- while true do
- m.clear()
- m.setBackgroundColor(colors.black)
- m.setCursorPos(1, 1)
- if data["active"] then
- m.write("Reactor Active: Yes")
- else
- m.write("Reactor Active: No")
- end
- m.setCursorPos(1, 2)
- m.write("Network Energy: " .. data["energy"] .. "%")
- drawLine(m, 5, 10, colors.green)
- os.sleep(1)
- end
- end
- parallel.waitForAll(fetchData, displayData)
- function drawLine(m,x, y, lenght, color)
- bgColor = m.getBackgroundColor()
- for i = x, (lenght + x) do
- m.setCursorPos(i,y)
- m.setBackgroundColor(color)
- m.write(" ")
- end
- m.setBackgroundColor(bgColor)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement