Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #####Receiver:
- rednet.open(...)
- function lightsOn()
- rs.setOutput("right", true)
- end
- function lightsOff()
- rs.setOutput("right", false)
- end
- function detectSignal()
- event,id,message = os.pullEvent()
- if event == rednet_message and id == 1 then
- if message == "On" then
- lightsOn()
- elseif message == "Off" then
- lightsOff()
- end
- end
- end
- while true do
- detectSignal()
- end
- #####Sender:
- rednet.open(...)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Would you like to switch the lights on or off?")
- input = read()
- if input=="On" or input=="Off" then
- rednet.send(0, input)
- else
- print("Please use only 'On' and 'Off'.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement