Wouter0100

Door slave

May 29th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. sides = {"left", "right", "top", "bottom", "front", "back"}
  2. channel = os.getComputerID()
  3. print("Channel: " .. channel)
  4.  
  5. rednet.open("front", channel)
  6.  
  7. while true do
  8. id, msg = rednet.receive()
  9.  
  10. if msg < 1 and msg > 6 and msg < 11 and msg > 16 then
  11. print("Invalid message: " .. msg)
  12. else
  13. state = false
  14.  
  15. if msg > 10 then
  16. state = true
  17. msg = msg - 10
  18. end
  19.  
  20. print("Set ", sides[msg], " to ", state)
  21. rs.setOutput(sides[msg], state)
  22. end
  23. end
Add Comment
Please, Sign In to add comment