4 posts
Posted 08 November 2012 - 05:58 PM
ive got a computer set up a a 1x2 monitor (on the left of the computer) im trying to get it to display the time on the monitor in large numbers and update itself. my code (which i found on this website from a few months ago) thus far is:
function infiniteLoop()
while true do
local time = os.time()
time = textutils.formatTtime(time, false)
term.clear()
term.setCursorPos(1,1)
print(time)
sleep(0.8)
end
end
infiniteLoop()
the problem i am having is that it is not displaying on the monitor even when i run the program with the command "monitor left >program name<"
how can i fix this?
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 08 November 2012 - 06:02 PM
I don't know the codes because I have never used monitors, but you need to wrap the monitor and also print on the monitor, not on the computer's monitor.
4 posts
Posted 08 November 2012 - 06:06 PM
I don't know the codes because I have never used monitors, but you need to wrap the monitor and also print on the monitor, not on the computer's monitor.
ok now i have:
function infiniteLoop()while true domon=peripheral.wrap("left")
local time = os.time()time = textutils.formatTtime(time, false)term.clear()term.setCursorPos(1,1)mon.print(time)sleep(0.8)endendinfiniteLoop()still not working.
59 posts
Location
Norway
Posted 08 November 2012 - 06:13 PM
Yeah as brett is saying you need to wrap the monitor first. so:
m = peripheral.wrap("side")
m.write("time")
144 posts
Location
Wellington, New Zealand
Posted 08 November 2012 - 06:16 PM
mon = peripheral.wrap("left")
mon.setTextScale(3)
while true do
time = os.time()
time = textutils.formatTime(time, false)
mon.clear()
mon.setCursorPos(1,1)
mon.writeLine(time)
sleep(1)
end
You could try that. Not sure if it'll work D:
4 posts
Posted 08 November 2012 - 06:32 PM
thanks everyone who helped me out!
added the text scale line so that the time fits perfectly with the 1x2 monitor.
the final code was as follows:
function infiniteLoop()
while true do
m = peripheral.wrap("left")
m.setTextScale(3)
local time = os.time()
time = textutils.formatTime (time, false)
mon.clear ()
mon.setCursorPos(1,1)
mon.write(time)
sleep(1)
end
end
infiniteLoop()
Thanks again!