Advertisement
devomaa

Colorful Lights Rednet

Jun 5th, 2021
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. rednet.open("top")
  2. print("RedNet Open, Poggers!")
  3. local id = os.computerID()
  4. print("Send CODE to", id, "to open")
  5.  
  6. while true do
  7. data = {rednet.receive()}
  8. if data[2] == "on" then
  9. for i, v in pairs(peripheral.getNames()) do
  10. if peripheral.getType(v) == "colorful_lamp" then
  11. local obj = peripheral.wrap(v)
  12. obj.setLampColor(32767)
  13. end
  14. end
  15. if data[2] == "off" then
  16. for i, v in pairs(peripheral.getNames()) do
  17. if peripheral.getType(v) == "colorful_lamp" then
  18. local obj = peripheral.wrap(v)
  19. obj.setLampColor(0)
  20. end
  21. end
  22. end
  23. end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement