Posted 13 October 2012 - 06:54 AM
Ive been trying to loop the code below so it refreshes on the screen. The problem is the code just freezes and doesn't update. I have looked around and i cant understand why it isn't working. My current code is below
-- Reactor control: Turn off reactor
rout = colors.combine(rout,colors.red)
rs.setBundledOutput("bottom",rout)
-- Make sure input is intialised
rin=rs.getBundledInput("bottom")
mon = peripheral.wrap('top')
mon.setTextScale(1)
i = 1
while i <= 5 do
mon.clear()
mon.setCursorPos(3,1)
mon.write("========POISONSYS REACTOR=========")
mon.setCursorPos(3,2)
mon.write("=======CONTROL SYSTEM V1.0========")
if(colors.test(rout,colors.red)) then
mon.setCursorPos(1,4)
mon.write("Reactor is : OFFLINE")
else
mon.setCursorPos(1,4)
mon.write("Reactor is : ONLINE")
end
if(colors.test(rin,colors.black)) then
mon.setCursorPos(1,6)
mon.write("Wtr_cooling is : ONLINE")
else
mon.setCursorPos(1,6)
mon.write("Wtr_cooling is : OFFLINE")
end
if(colors.test(rin,colors.green)) then
mon.setCursorPos(1,8)
mon.write("Ice_cooling is : ONLINE")
else
mon.setCursorPos(1,8)
mon.write("Ice_cooling is : OFFLINE")
end
i = i + 1
sleep(2)
end