Guest User

Untitled

a guest
Nov 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. rednet.open("top")
  2. function togglelights()
  3.  state = rs.getOutput("left")
  4.  if state==true then
  5.   rs.setOutput("left", false)
  6.   return false
  7.  else
  8.   rs.setOutput("left", true)
  9.   return true
  10.  end
  11. end
  12. while true do
  13. event, id, text = os.pullEvent()
  14. if event=="rednet_message" then
  15.  if text=="togglelights" then
  16.  if togglelights()==true then
  17.   rednet.send(id, "The lights have been turned on")
  18.  else
  19.   rednet.send(id, "The light have been turned off"
  20.  end
  21.  end
  22. end
  23. end
Add Comment
Please, Sign In to add comment