legg0028

bee_farm_receive

Nov 25th, 2022
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. local modem = peripheral.wrap("left")
  2. modem.open(00004)
  3.  
  4. redstone.setOutput("right",true)
  5.  
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. print("Waiting on message.")
  9.  
  10. while true do
  11. local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  12.  
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. print("Message received: "..message)
  16. print("Channel: "..senderChannel)
  17.  
  18. if senderChannel == 4 and message == "off" then
  19. redstone.setOutput("right",false)
  20. elseif senderChannel == 4 and message == "on" then
  21. redstone.setOutput("right",true)
  22. end
  23. sleep(0.1)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment