SHOW:
|
|
- or go back to the newest paste.
| 1 | local function clearScreen() | |
| 2 | term.clear() | |
| 3 | term.setCursorPos(1, 1) | |
| 4 | end | |
| 5 | ||
| 6 | local modem = peripheral.find("modem") or error("No modem attached", 0)
| |
| 7 | modem.open(43) -- Open 43 so we can receive replies | |
| 8 | ||
| 9 | - | modem.transmit(15, 43, "Remote Connected") |
| 9 | + | |
| 10 | print("Enter your message:")
| |
| 11 | local userMessage = read() | |
| 12 | modem.transmit(15, 43, userMessage) | |
| 13 | ||
| 14 | -- And wait for a reply | |
| 15 | local event, side, channel, replyChannel, message, distance | |
| 16 | repeat | |
| 17 | event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
| |
| 18 | - | print(tostring(message)) |
| 18 | + | |
| 19 | ||
| 20 | clearScreen() | |
| 21 | ||
| 22 | print(tostring(message)) |