Posted 26 September 2014 - 12:10 PM
Hey Guys,
I need a program that I can control my reactor. It should run automatically a certain time and then turn off. In addition, it should automatically perform an emergency shutdown when a redstone signal comes from the left. I have written a program, but unfortunately it does not work. I hope you can help me.
Many thanks!
Here is the code:
I need a program that I can control my reactor. It should run automatically a certain time and then turn off. In addition, it should automatically perform an emergency shutdown when a redstone signal comes from the left. I have written a program, but unfortunately it does not work. I hope you can help me.
Many thanks!
Here is the code:
local monitor = peripheral.wrap("top")
monitor.clear()
monitor.setTextScale(1.5)
monitor.setCursorPos(2,3)
monitor.write("<Reaktor 1 AKTIV>")
monitor.setCursoPos(4,3)
monitor.write("Automatische Abschaltung in:")
monitor.setCursorPos(6,3)
redstone.setOutput("right", true)
monitor.write("3:00")
sleep(1)
for minutes = 2, 0, -1 do
for seconds = 59, 0, -1 do
monitor.clear()
monitor.setCursorPos(2,3)
monitor.write("<Reaktor 1 AKTIV>")
monitor.setCursoPos(4,3)
monitor.write("Automatische Abschaltung in:")
monitor.setCursorPos(6,3)
monitor.write((minutes < 10 and "0"..minutes or minutes)..":"..(seconds < 10 and "0"..seconds or seconds))
sleep(1)
if redstone.getInput("left", true) then shell.run"Stoerfall"
end
end
redstone.setOutput("right", false)
monitor.clear()
monitor.setCursorPos(6,3)
monitor.write("00:00")
sleep(5)
monitor.clear()
monitor.setCursorPos(2,3)
monitor.write("<Reaktor 1 wurde abgeschaltet>")
sleep(20)
os.reboot()