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

help with making a timer

Started by reagain111, 20 June 2014 - 12:04 AM
reagain111 #1
Posted 20 June 2014 - 02:04 AM
I'm trying to make a 5 second timer on a monitor to the right.I am very bad(don't know a single thing) at programming.I want the number in the monitor pretty big.the timer will start with a redstone signal to the front and when it ends give a redstone signal to the back.If anyone can help i'd appreciate it.I don't know if this is possible but iv'e seen a lot of crazy programs from computercraft.
CCJJSax #2
Posted 20 June 2014 - 05:32 AM
pretty simple stuff. Look on the forums for some tutorials that will help you out greatly.


mon = peripheral.wrap("right") -- wrap the monitor
mon.setTextScale(5)
while true do
evt, p1, p2 = os.pullEvent()
if evt == "redstone" then
  if rs.getInput("front") == true then
   rs.setOutput("back", false) -- note that this might not be when you want it to turn off.
   for i = 5, 0, -1 do
    mon.clear()
    mon.setCursorPos(1, 1)
    mon.write(i)
    sleep(1)
   end
   mon.clear()
   rs.setOutput("back", true)
  end
end
end

that should mostly do it.
reagain111 #3
Posted 20 June 2014 - 08:33 AM
pretty simple stuff. Look on the forums for some tutorials that will help you out greatly.


mon = peripheral.wrap("right") -- wrap the monitor
mon.setTextScale(5)
while true do
evt, p1, p2 = os.pullEvent()
if evt == "redstone" then
  if rs.getInput("front") == true then
   rs.setOutput("back", false) -- note that this might not be when you want it to turn off.
   for i = 5, 0, -1 do
	mon.clear()
	mon.setCursorPos(1, 1)
	mon.write(i)
	sleep(1)
   end
   mon.clear()
   rs.setOutput("back", true)
  end
end
end

that should mostly do it.
Thanks's so much for this!!!Your awesome.Now I can finally do what I want to.