Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("front")
- rs.setOutput("top", false)
- isTiming = false
- isGreen = rs.getInput("back")
- shouldOutput = false
- isPassthrough = false
- timer = nil
- if isGreen then
- rs.setOutput("top", true)
- sleep(.1)
- rs.setOutput("top", false)
- end
- while true do
- event = {os.pullEvent()}
- print("Event = "..event[1])
- if event[1] == "redstone" then
- print("Redstone event")
- if rs.getInput("front") then
- isPassthrough = true
- elseif not isTiming then
- isPassthrough = false
- print("Not timing")
- if rs.getInput("left") then
- print("Starting timer")
- isTiming = true
- timer = os.startTimer(16)
- rednet.broadcast("15")
- end
- end
- isGreen = rs.getInput("back")
- if isGreen then print("isGreen = true") else print("isGreen = false") end
- elseif event[1] == "timer" then
- print("Timer event")
- if event[2] == timer then
- print("Timer done")
- isTiming = false
- shouldOutput = true
- end
- end
- if isGreen then
- if isPassthrough then
- rs.setOutput("top", true)
- sleep(1.5)
- rs.setOutput("top", false)
- isPassthrough = false
- elseif shouldOutput then
- rs.setOutput("top", true)
- sleep(.1)
- rs.setOutput("top", false)
- shouldOutput = false
- end
- end
- print("")
- end
Advertisement
Add Comment
Please, Sign In to add comment