Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ***********
- * autoDoorSender
- *
- * argument1: side of wireless modem.
- * argument2: channelID.
- **********
- ]]
- ----------
- -- Variables.
- ----------
- -- define vars.
- local args = {...}
- local side = args[1]
- local channelID = args[2]
- ----------
- -- Main Thread.
- ----------
- local p = peripheral.wrap(side)
- p.open(channelID)
- while true do
- p.transmit(channelID, channelID, channelID)
- local timerID = os.startTimer(3)
- local eventName, return1, return2, return3, return4, return5 = os.pullEvent()
- if eventName == "modem_message" and tonumber(return2) == channelID then
- if tonumber(return5) < 5 then
- rs.setOutput("top", true)
- else
- rs.setOutput("top", false)
- end
- end
- if eventName ~= "timer" or tonumber(return1) ~= timerID then
- sleep(2.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement