Saereth

Timer

Sep 4th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local INPUT_SIDE = "left" -- change based on where your lever is
  2. local OUTPUT_SIDE = "right" -- change based on where your output side is
  3. local IDLE_TIME = .1 -- time (in sec) for cc to wait, rec 30, allows timer to survive reboot
  4.  
  5. --start an infinite loop
  6. --hold CTRL+T to stop the program
  7. while true do
  8. --wait for lever to be thrown, or check if red is already active after IDLE_TIME
  9.  
  10. --pulse the output
  11. while rs.getInput(INPUT_SIDE) do--while lever is ON
  12. rs.setOutput(OUTPUT_SIDE,true)--turn output on
  13. sleep(.1) --wait 0.1 sec
  14. rs.setOutput(OUTPUT_SIDE,false)--turn output off
  15. sleep(IDLE_TIME)
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment