Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- local version ="V0.1a"
- local printer = peripheral.wrap("bottom")
- local modem = peripheral.wrap("left")
- local role = "sender"
- local tchannel = 100
- local rchannel = 999
- --Body Code
- if role == "sender" then
- while true do
- write("message?: ")
- message = read()
- local event, key = os.pullEvent("key")
- if key == keys.enter then
- modem.transmit(tchannel , rchannel , message )
- end
- end
- end
- if role == "reciever" then
- modem.open(tchannel )
- while true do
- event, side, frequency, replyFrequency, message, distance = os.pullEvent("modem_message")
- print("Message received from the open modem on the "..side" side of this computer.")
- print("Frequency: "..frequency)
- print("Requested reply frequency: "..replyFrequency)
- print("Distance: "..distance)
- write("Message is as follows: "..message)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement