SHOW:
|
|
- or go back to the newest paste.
| 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 = 30 -- time (in sec) for cc to wait, rec 30, allows timer to survive reboot |
| 3 | + | local IDLE_TIME = .1 -- time (in sec) for cc to wait, rec 30, allows timer to survive reboot |
| 4 | ||
| 5 | - | --start an infini8te loop |
| 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 | - | parallel.waitForAny(function() e = os.pullEvent("redstone"); return true end, function() sleep(IDLE_TIME); return true end)
|
| 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 | - | write(".") --print a dot each time we pulse
|
| 13 | + | sleep(.1) --wait 0.1 sec |
| 14 | rs.setOutput(OUTPUT_SIDE,false)--turn output off | |
| 15 | - | sleep(.2) --wait 0.1 sec |
| 15 | + | sleep(IDLE_TIME) |
| 16 | end | |
| 17 | - | sleep(IDLE_TIME) --wait 0.9 sec |
| 17 | + | end |