Posted 09 June 2012 - 06:49 AM
Hello, I recently began using ComputerCraft (last night) and i am having some issues with a simple program i'm making to switch my nuclear reactor on/off. I got the basics down but im still having an issue, anyways this is my program:
what i want to do is to add an event so when the computer receives a redstone signal from an adjacent block , it can cut the redstone signal to the reactor.
what i have to the right is the remote thermal monitor from the ic2 reactor control addon, it emits a redstone signal when the reactor temperature reaches a value set by you
what i was thinking is something along the lines of:
but when I apply the redstone signal nothing happens. can someone please correct my code?
function clear(test)
term.clear()
term.setCursorPos(1,1)
if test == nil then
print("Press 1 to turn on, 2 to turn off or 3 to exit")
end
end
clear()
while true do
event, param1 = os.pullEvent()
if event == "char" and param1 == "1" then
print("Turning on reactor")
sleep(2)
rs.setOutput("bottom",true)
clear()
elseif event == "char" and param1 == "2" then
print("Shutting Down")
sleep(2)
rs.setOutput("bottom",false)
clear()
elseif event == "char" and param1 == "3" then
print("Have a nice day!")
sleep(2)
break
end
end
clear(1)
what i want to do is to add an event so when the computer receives a redstone signal from an adjacent block , it can cut the redstone signal to the reactor.
what i have to the right is the remote thermal monitor from the ic2 reactor control addon, it emits a redstone signal when the reactor temperature reaches a value set by you
Spoiler
what i was thinking is something along the lines of:
elseif event == "redstone" and param1 == "right" then
monitor = peripheral.wrap("top")
term.redirect(monitor)
print("Reactor overheated, shutting down")
term.restore()
rs.setOutput("bottom",false)
sleep(3)
monitor.clear()
but when I apply the redstone signal nothing happens. can someone please correct my code?