Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function close(bool)
- rs.setOutput("left",bool)
- rs.setOutput("back",bool)
- end
- function open()
- close(false)
- sleep(2)
- close(true)
- end
- close(true)
- local modem = peripheral.wrap("bottom")
- modem.closeAll()
- modem.open(1)
- local auto = true
- while true do
- event,side,freq,refreq,msg,dist = os.pullEvent("modem_message")
- if freq == 1 then
- if msg == "open" then
- auto = false
- close(false)
- write("force open")
- elseif msg == "close" then
- auto = false
- close(true)
- write("force close")
- elseif msg == "auto" then
- auto = true
- write("auto on")
- elseif msg == "opc" and dist < 5 and auto then
- open()
- write("open- "..dist.."\n")
- else
- if auto then
- write("reject- freq:"..freq..",.refreq:"..refreq.."msg"..msg.."dist"..dist.."\n")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement