Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.find("bitnet_tower")
- tArgs = {...}
- function receive()
- print("Waiting message...")
- while true do
- event, side, message, distance = os.pullEvent("bitnet_message")
- print("\nReceived message: "..message)
- print("Received from "..distance.." blocks away")
- end
- end
- function pressKeyStop()
- print("Press any key to stop")
- os.pullEvent("char")
- end
- function send()
- print("What do I send?")
- p.transmit(read())
- end
- print("Send or Receive mode?\n(Use 'send' or 'receive')")
- if tArgs[1] == "send" then
- send()
- elseif tArgs[1] == "receive" then
- parallel.waitForAny(pressKeyStop, receive)
- else print("What?")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement