Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("top")
- local mon = peripheral.wrap("bottom")
- modem.open(2)
- function numberToText(number)
- local num = tonumber(number)
- if num >= 1000000000 then return (math.floor(num/1000000000) .. " T") end
- if num >= 1000000 then return (math.floor(num/1000000) .. " M") end
- if num >= 1000 then return (math.floor(num/1000) .. " k") end
- end
- while true do
- modem.transmit(1,2,"getEnergy")
- local event, mS, sC, rC,
- data, sD = os.pullEvent("modem_message")
- print(data["en"] .. " - " .. data["enPT"])
- mon.clear()
- mon.setTextScale(3)
- mon.setCursorPos(1,1)
- mon.write(numberToText(data["en"]))
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement