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

writing to a monitor

Started by AZR43L, 31 May 2014 - 11:50 PM
AZR43L #1
Posted 01 June 2014 - 01:50 AM
Hello, i have the following setup:



The task is simple to send a redstone signal and launch the train every X minutes…
I've written the following code:


while true do
  local monitor = peripheral.wrap("left")
  if monitor then
	--If I put a write statement where it will get printed in the normal "terminal" window indicating that a monitor was found
	monitor.clear()
	monitor.setCursorPos(0,0)
	monitor.write("releasing train")
  end
  redstone.setOutput("back", true)
  sleep(2)
  redstone.setOutput("back", false)
  if monitor then
	monitor.clear()
	monitor.setCursorPos(0,0)
	monitor.write("waiting...")
  end

  sleep(60 * 2)
end

It will find the monitor on the left (if tried right and it, obviously, don't find it on the right) and enter the monitor code block, runs without runtime errors but nothing is printed on the monitor…

Can anyone help me with the ultra simple thing?

Thanks
TimTheRedstoner #2
Posted 01 June 2014 - 02:46 AM
you need to make it monitor.setCursorPos(1,1)


not (0,0)




the complete code would be


while true do
  local monitor = peripheral.wrap("left")
  if monitor then
		--If I put a write statement where it will get printed in the normal "terminal" window indicating that a monitor was found
		monitor.clear()
		monitor.setCursorPos(1,1)
		monitor.write("releasing train")
  end
  redstone.setOutput("back", true)
  sleep(2)
  redstone.setOutput("back", false)
  if monitor then
		monitor.clear()
		monitor.setCursorPos(1,1)
		monitor.write("waiting...")
  end

  sleep(60 * 2)
end
Edited on 01 June 2014 - 12:49 AM
AZR43L #3
Posted 01 June 2014 - 03:15 AM
Ops… :ph34r:/>
Thanks!