Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = peripheral.wrap("top")
- b = peripheral.wrap("right")
- c = peripheral.wrap("bottom")
- rednet.open("left")
- local mEnergy = 0
- local nEnergy = 0
- local pEnergy = 0
- local nLit = 0
- local rOutput = 0
- local nLamps = 7
- local excess = 0
- while true do
- idA,stateA,titleA,dataA = a.get(1)
- idB,stateB,titleB,dataB = b.get(1)
- idC,stateC,titleC,dataC = c.get(1)
- mEnergy = tonumber(dataA["maxStorageL"]) + tonumber(dataB["maxStorageL"]) + tonumber(dataC["maxStorageL"])
- nEnergy = tonumber(dataA["energyL"]) + tonumber(dataB["energyL"]) + tonumber(dataC["energyL"])
- pEnergy = (nEnergy / mEnergy) * 100
- pEnergy = math.floor(pEnergy)
- if nEnergy > mEnergy then
- excess = nEnergy - mEnergy
- nEnergy = nEnergy - excess
- end
- nLit = math.floor((nEnergy / mEnergy) * nLamps)
- rOutput = (2 ^ nLit) - 1
- redstone.setBundledOutput("back",rOutput)
- term.clear()
- term.setCursorPos(1,1)
- term.write(nEnergy.."eu of "..mEnergy.."eu")
- term.setCursorPos(1,2)
- term.write((pEnergy).."%")
- term.setCursorPos(1,3)
- term.write(nLit.." leds lit")
- info = {nEnergy, mEnergy, pEnergy, nLit}
- euData = textutils.serialize(info)
- rednet.send(11, euData)
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment