Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor = peripheral.wrap("back")
- local cell = peripheral.wrap("right")
- local mon = peripheral.wrap("left")
- local max = cell.getMaxEnergyStored("right")
- local Lthreshold = max / 2
- local Uthreshold = max - 5000
- local str = "off"
- local function getPower()
- local energy = cell.getEnergyStored("right")
- return energy
- end
- while true do
- if(getPower() > Uthreshold) then
- reactor.setActive("false")
- str = "off"
- elseif(getPower() < Lthreshold) then
- reactor.setActive("true")
- str = "on"
- end
- mon.clear()
- mon.setCursorPos(0,0)
- mon.write(str)
- print(str)
- os.sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement