Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("back")
- modem.open(00005)
- local status = 1
- redstone.setOutput("top",false)
- redstone.setOutput("bottom",false)
- term.clear()
- term.setCursorPos(1,1)
- print("Waiting on message")
- while true do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- term.clear()
- term.setCursorPos(1,1)
- print("Message received: "..message)
- print("Channel: "..senderChannel)
- if senderChannel == 5 and message == "open" and status == 1 then
- redstone.setOutput("bottom",true)
- redstone.setOutput("top",true)
- status = 2
- elseif senderChannel == 5 and message == "open" and status == 2 then
- redstone.setOutput("bottom",false)
- redstone.setOutput("top",false)
- status = 1
- end
- sleep(0.1)
- end
Add Comment
Please, Sign In to add comment