Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------
- -- Hypno's Redstone Energy Cell Monitor --
- -- --
- -- Hypno HermitCraft FTB Unleashed S2E16 --
- -- https://www.youtube.com/watch?v=rZPJd3SC3FQ --
- -- --
- -- YouTube Channel http://youtube.com/hypnotizd --
- ----------------------------------------------------------
- local function getPower(i)
- local p = peripheral.wrap("right")
- return p.callRemote(i, "getEnergyStored")
- end
- local function getStatus()
- local status = "Discharging"
- if (rs.getOutput("left")) then
- status = "Charging"
- end
- return status
- end
- local function getPeripherals()
- local t = {}
- for k, v in pairs(peripheral.getNames()) do
- if (string.find(v, "redstone_energy_cell")) then
- t[v] = getPower(v)
- end
- end
- return t
- end
- while true do
- local t = getPeripherals()
- local power = 0
- local i = 0
- term.clear()
- term.setCursorPos(1,1)
- for k, v in pairs(t) do
- print("Cell "..(i+1)..": "..v)
- power = power + v
- i = i + 1
- end
- if ((power/i) > 550000) then
- rs.setOutput("left", false)
- elseif ((power/i) < 300000) then
- rs.setOutput("left", true)
- end
- print("")
- print("Average: "..(power/i))
- print("Status: "..getStatus())
- os.sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement