MtnMCG

tp

Sep 7th, 2024 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. -- Pocket Computer Control Program
  2.  
  3. rednet.open("back") -- Adjust if your modem is on a different side
  4.  
  5. while true do
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. print("Block Toggle Control")
  9. print("1. Toggle block")
  10. print("2. Exit")
  11.  
  12. local _, key = os.pullEvent("key")
  13.  
  14. if key == keys.one then
  15. rednet.broadcast("toggle", "trapdoor")
  16. print("Signal sent to turtle")
  17. local sender, message = rednet.receive("trapdoor_response", 5)
  18. if message then
  19. print("Turtle response: " .. message)
  20. else
  21. print("No response from turtle")
  22. end
  23. sleep(2)
  24. elseif key == keys.two then
  25. break
  26. end
  27. end
  28.  
  29. rednet.close("back")
Advertisement
Add Comment
Please, Sign In to add comment