This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dai_knapz's profile picture

Sleep problems

Started by dai_knapz, 22 May 2013 - 08:39 AM
dai_knapz #1
Posted 22 May 2013 - 10:39 AM
I've recently been trying to get an detection loop working for a minecart system destination selector. The code all works fine apart from resetting. When I tell the system to sleep it hangs not clearing the screen or resuming the detection loop. If I remove the sleep , the orange output will not stay on (or rather not turn on at all). With the sleep the orange output stays on, and the system does not resume. Any ideas?

Here's the code

term.clear()
term.setCursorPos(1,1)
i=0
local function test(rsColour,colour)
   if rs.testBundledInput("right", rsColour) == true then
rs.setBundledOutput("right", colors.orange)
term.setTextColor(rsColour)
	   print("The next train to arrive will be ".. colour)
	   print("Test")
	   sleep(2)
	   rs.setBundledOutput("right", 0)
	   term.clear()
    end
end
while true do
  os.pullEvent("redstone")
  term.clear()
  term.setCursorPos(1,1)
  test(colors.lime,"lime")
  test(colors.pink,"pink")
  test(colors.blue,"blue")
end   
Any help would be greatly appreciated.
Lyqyd #2
Posted 22 May 2013 - 01:05 PM
Split into new topic.
KaoS #3
Posted 23 May 2013 - 02:33 AM
it seems like the PC is somehow missing the timer event. Try restarting the PC and do not run any other code at all. No OSs etc, this could be caused by a bad coroutine setup