Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function startReactor()
- while true do
- reactor = peripheral.wrap("back");
- if reactor ~= nil then
- if reactor.getConnected() then
- if reactor.getEnergyStored() > 4000000 then
- print("At 4000000RF Turning Off")
- reactor.setActive(false);
- end
- if reactor.getEnergyStored() < 1000000 then
- print("At 1000000RF Turning On")
- reactor.setActive(true);
- end
- end
- end
- sleep(0);
- end
- end
- quit = false
- function quitProgram()
- local event, name = os.pullEvent("quit")
- if name == "powerMonitor" then
- quit = true
- end
- end
- while true do
- parallel.waitForAny(quitProgram, startReactor)
- if quit then
- print("Quitting....")
- break
- end
- end
Add Comment
Please, Sign In to add comment