Guest User

Untitled

a guest
Oct 27th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. rednet.open("right") --enable the modem attached to the right side of the PC
  2. rednet.broadcast("Hello world") --send "Hello world" over rednet to all PCs in range
  3. print("PC1 - Hello world")
  4. id,message = rednet.receive() --wait until something is received over rednet
  5. if id == 2 and message == "Hello from pc2" then
  6. write("PC2 -")
  7. print(message)
  8. rednet.send(2,"How are you") --Send a message only to the PC with ID 2
  9. print("PC1 - How are you")
  10. id,message = rednet.receive(10) --Wait until a message arrives or 10 seconds pass
  11. if message == "Fine thanks" then
  12. print("PC2 - Fine thanks")
  13. end
  14. end
  15. print("disconnecting")
  16. rednet.close("right") --disable modem on the right side of the PC
Add Comment
Please, Sign In to add comment