Mralko99

Timer

Jun 8th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. timerAttivo = true
  2. latoTimer = "back"
  3. durataSegnale = 0.2
  4. intervalloTimer = 1
  5. posizioneLeva = "right"
  6.  
  7. function runTimer()
  8.     while timerAttivo == true do
  9.         print (shell.run("redprobe"))
  10.         if redstone.getInput(posizioneLeva) then
  11.             timerAttivo = true
  12.             redstone.setOutput(latoTimer, true)
  13.             sleep (durataSegnale)
  14.             redstone.setOutput(latoTimer, false)   
  15.             sleep (intervalloTimer)
  16.         else
  17.             timerAttivo = false
  18.         end    
  19.     end
  20. end
  21.  
  22. -- loop infinito
  23. while true do
  24.         os.pullEvent("redstone")
  25.         timerAttivo = true
  26.         runTimer()
  27. end
Advertisement
Add Comment
Please, Sign In to add comment