Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- function togglelights()
- state = rs.getOutput("left")
- if state==true then
- rs.setOutput("left", false)
- return false
- else
- rs.setOutput("left", true)
- return true
- end
- end
- while true do
- event, id, text = os.pullEvent()
- if event=="rednet_message" then
- if text=="togglelights" then
- if togglelights()==true then
- rednet.send(id, "The lights have been turned on")
- else
- rednet.send(id, "The light have been turned off"
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment