SHOW:
|
|
- or go back to the newest paste.
| 1 | - | -- Open the modem. Same as the first program |
| 1 | + | function startMonitor() |
| 2 | - | rednet.open("top")
|
| 2 | + | monitor.setTextScale(1) |
| 3 | wm, hm = monitor.getSize() | |
| 4 | end | |
| 5 | - | print("Waiting for a message")
|
| 5 | + | |
| 6 | function newLine() | |
| 7 | local _,cY= monitor.getCursorPos() | |
| 8 | - | print("Message received from comptuer ID: " .. id)
|
| 8 | + | monitor.setCursorPos(1,cY+1) |
| 9 | - | print("Message says: " .. message) |
| 9 | + | end |
| 10 | ||
| 11 | monitor = peripheral.wrap("left")
| |
| 12 | local w,h = term.getSize() | |
| 13 | local monP = peripheral.isPresent("left")
| |
| 14 | local monT = peripheral.getType("left")
| |
| 15 | local cX,cY = monitor.getCursorPos() | |
| 16 | term.redirect(monitor) | |
| 17 | ||
| 18 | while true do | |
| 19 | ||
| 20 | -- Open the modem. | |
| 21 | rednet.open("back")
| |
| 22 | ||
| 23 | -- Wait for a message | |
| 24 | id, message = rednet.receive() | |
| 25 | ||
| 26 | print(message) | |
| 27 | ||
| 28 | newLine() | |
| 29 | ||
| 30 | end |