Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right") -- Open the modem on the side you want to use
- local channel = 123 -- Set the channel number
- print("Server running...")
- while true do
- local senderId, message, distance = rednet.receive(channel) -- Receive a message on the specified channel
- print("Message received from ID: " .. senderId)
- print("Message content: " .. message)
- print("Distance: " .. distance)
- -- Process the received message here
- -- Optionally, you can send a response back to the sender
- -- local response = "Received your message!"
- -- rednet.send(senderId, response, channel)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement