Posted 29 June 2012 - 01:53 PM
Hey guys this is my first post, but, how do I get a computer to slow print to a monitor when it receives an input pulse from the back? Thanks.
local monitorSide = "left" -- the side the monitor is on
local inputSide = "back" -- the side of the redstone signal
-- check if the monitor is present
if peripheral.isPresent(monitorSide) and peripheral.getType(monitorSide) == "monitor" then
-- redirect output to the monitor
term.redirect(peripheral.wrap(monitorSide))
else
-- monitor not found, exit the program
print("Monitor not found")
return
end
while true do
-- wait for change in redstone input
os.pullEvent("redstone")
-- check if the correct input is on
if rs.getInput(inputSide) then
-- print the text
textutils.slowPrint("TEXT HERE")
break -- stop the program after showing the text
end
end
-- restore output to the terminal
term.restore()