Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local string = require("string")
- local term = require("term")
- local math = require("math")
- local gpu = component.gpu
- local modem = component.modem
- local event = require("event")
- local previousValue = 0
- local resx, resy = gpu.getResolution()
- term.clear()
- while true do
- modem.open(6767)
- local _, _, _, port, _, protocole, energySource, receivedValue = event.pull("modem_message")
- if(port == 6767 and protocole == "eProtocole" and energySource == "wind") then
- term.clear()
- gpu.copy(1, 1, resx, resy,1,1,1,1)
- local barCalcul = math.floor((receivedValue/100000)*158)
- gpu.fill(1,3,1,3,"|")
- gpu.fill(160,3,1,3,"|")
- gpu.setBackground(0x006DFF)
- gpu.fill(2,3,barCalcul,3," ")
- gpu.setBackground(0xD2D2D2)
- gpu.setForeground(0x000000)
- print("Energie Type: "..energySource.." "..math.floor(receivedValue).."/100000 - "..((math.floor(receivedValue)/100000)*100).."%")
- if(receivedValue == 0) then
- gpu.set(45,1,"Empty")
- else
- gpu.set(1,2,string.format("% 5s",(math.floor((receivedValue-previousValue)/3))).." RF/s")
- end
- previousValue = receivedValue
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement