Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --b = peripheral.wrap("top")
- term.clear()
- limit = 20
- local function getPercentStored()
- b = peripheral.wrap("back")
- max = b.getMaxEnergyStored()
- stored = b.getEnergyStored()
- a = max / 100
- b = stored / a
- return math.ceil(b)
- end
- recharge = "off"
- local function runCheck()
- --term.clear()
- term.setCursorPos(1,1)
- print(textutils.formatTime(os.time(), false))
- print("Stored: "..getPercentStored().."% ")
- print(" ")
- print("Charge when below "..limit.."% ")
- print("Reactor: "..recharge.." ")
- if recharge == "on" then
- --turn redstone signal on!
- redstone.setOutput("left",true)
- else
- --turn redstone signal off!
- redstone.setOutput("left",false)
- end
- if getPercentStored() < limit then
- recharge = "on"
- elseif (getPercentStored() > 95)
- and (recharge == "on") then
- recharge = "off"
- end
- end
- while true do
- --sleep(1)
- runCheck()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement