Advertisement
DOGGYWOOF

Untitled

Jan 1st, 2024 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. rednet.open("right") -- Open the modem on the side you want to use
  2. local channel = 123 -- Set the channel number
  3.  
  4. print("Server running...")
  5.  
  6. while true do
  7. local senderId, message, distance = rednet.receive(channel) -- Receive a message on the specified channel
  8.  
  9. print("Message received from ID: " .. senderId)
  10. print("Message content: " .. message)
  11. print("Distance: " .. distance)
  12.  
  13. -- Process the received message here
  14.  
  15. -- Optionally, you can send a response back to the sender
  16. -- local response = "Received your message!"
  17. -- rednet.send(senderId, response, channel)
  18. end
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement