Sparkybearbomb

Wired to wireless relay

Mar 18th, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. wireless = "right"
  2. wired = "top"
  3.  
  4. modem1 = peripheral.wrap(wireless)
  5. modem2 = peripheral.wrap(wired)
  6.  
  7. modem1.open(50)
  8. modem1.open(100)
  9. modem1.open(150)
  10. modem1.open(200)
  11. modem1.open(300)
  12.  
  13. modem2.open(50)
  14. modem2.open(100)
  15. modem2.open(150)
  16. modem2.open(200)
  17. modem2.open(300)
  18.  
  19. while true do
  20.     local event,side,freq,rplfreq,msg,dist = os.pullEvent("modem_message")
  21.     print(msg)
  22.     if side == wireless then
  23.         modem2.transmit(freq,rplfreq,msg)
  24.     elseif side == wired then
  25.         modem1.transmit(freq,rplfreq,msg)
  26.     else
  27.        print("Lost Message - check side config")
  28.     end
  29.  
  30. end
Add Comment
Please, Sign In to add comment