This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
toblerone321's profile picture

Rednet Cable .send/.broadcast mixup?

Started by toblerone321, 22 September 2013 - 12:01 PM
toblerone321 #1
Posted 22 September 2013 - 02:01 PM
I am relatively new to computercraft and I have set up 8 airport boards connected to 1 Computer(the server) with bundled cable. I know that this is not the best thing to use but due to the long distance and low altitude I have to use it. I would like to be able to output separate messages on separate boards, and I thought I had it working, however, when I send a message via rednet to one computer controlling one board, the same message appears on all 8 boards? Why is this?

Server code:
function main()
  term.clear()
  term.setCursorPos(1,1)
  rednet.open("top")
  print("Airport Gate Screen Server booting...")
  os.sleep(3)
  print("Please enter the screen ID to change")
  id = tonumber(read())
  print("Please enter flight # & location")
  message = read()
  rednet.send(id,message)
  main()
end
main()

(The server ID is 44)

Board client code:
function rednetreceive()
  rednet.open("front")
  id,message = rednet.receive()
  if id == 44 then
   screen()
  end
end
function screen()
  size = 1
  side = "back"
  mon = peripheral.wrap(side)
  mon.setTextScale(size)
  mon.setCursorPos(9,3)
  mon.clear()
  mon.write(message)
  local cX,cY = mon.getCursorPos()
  mon.setCursorPos(1,cY+2)
  mon.write("Departure expected: **:**")
  rednetreceive()
end
rednetreceive()
screen()
rednetreceive()

It is probably something stupid, but please take a look. thanks!
Lyqyd #2
Posted 22 September 2013 - 02:22 PM
Split into new topic.
Grim Reaper #3
Posted 22 September 2013 - 03:39 PM
Although I'm not entirely sure how the rednet API behaves when used with bundled cable, I know that the rednet API was meant for wireless modems or wired modems, not bundled cable. As for bundled cable, you'll need to look into the Redstone API for instruction as to how you should use it communicate with multiple computers (I don't have much experience with redstone, sorry).
toblerone321 #4
Posted 22 September 2013 - 04:42 PM
Although I'm not entirely sure how the rednet API behaves when used with bundled cable, I know that the rednet API was meant for wireless modems or wired modems, not bundled cable. As for bundled cable, you'll need to look into the Redstone API for instruction as to how you should use it communicate with multiple computers (I don't have much experience with redstone, sorry).
Thank you for your help, I will look into this as I'm not too sure about how redstone interacts with Computers either!