Jump to content




Program appears to freeze on run


  • You cannot reply to this topic
2 replies to this topic

#1 DragonZero

  • New Members
  • 2 posts

Posted 11 September 2016 - 04:13 AM

When I run this program, the computer appears to lock up. Ctrl + T and Enter both fail to end the program (ctrl + r works, though), and no text appears on the monitor.
monitor=peripheral.wrap("monitor_0")
monitor.setTextScale(5)
function diplayTime()
  local timeRaw = 0
  local timeSec = 0
  local timeMin = 0
  local timeHrr = 0
  while true do
	monitor.clear()
	monitor.setCursorPos(1,4)
	monitor.write(timeRaw)
	os.sleep(1)
	timeRaw = timeRaw + 1
  end
end  
function breakLoop()
  while true do
	local event, par1 = os.pullEvent("key")
	if par1 == 28 then
	  print("Ending Program.")
	  break
	end
  end
end
parallel.waitForAny(displayTime,breakLoop)



#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 11 September 2016 - 04:55 AM

The only obvious problem I can see is the "diplayTime" typo, though I really would expect that to generate an error - are you sure this is the actual code you're running?

#3 DragonZero

  • New Members
  • 2 posts

Posted 11 September 2016 - 02:26 PM

View PostBomb Bloke, on 11 September 2016 - 04:55 AM, said:

The only obvious problem I can see is the "diplayTime" typo, though I really would expect that to generate an error - are you sure this is the actual code you're running?
Fixing the typo seems to have fixed the code. I don't know why it didn't throw error, unless there was another function somewhere called diplayTime, but this was the only program I had written on this computer. Thanks for the help.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users