SHOW:
|
|
- or go back to the newest paste.
1 | - | glass = peripheral.wrap("down") |
1 | + | function findAndWrap(devType) |
2 | local devices = peripheral.getNames() | |
3 | for id, devName in pairs(devices) do | |
4 | if peripheral.getType(devName) == devType then | |
5 | - | glass.addBox(1,1,80,10,0xFFFFFF,0.2) |
5 | + | return peripheral.wrap(devName) |
6 | end | |
7 | end | |
8 | end | |
9 | - | function timeDis() |
9 | + | |
10 | glass = findAndWrap("openperipheral_bridge") | |
11 | rednet.open("right") | |
12 | ||
13 | - | glass.addText(5,2,"TIME: " .. time, 0xFF0000) |
13 | + | |
14 | ||
15 | glass.addBox(1,1,200,100,0xFFFFFF,0.2) | |
16 | ||
17 | end | |
18 | ||
19 | function timeDis(message) | |
20 | ||
21 | time = textutils.formatTime(os.time(), false) | |
22 | ||
23 | glass.addText(5,2, message, 0xFF0000) | |
24 | ||
25 | - | timeDis() |
25 | + | |
26 | ||
27 | function start() | |
28 | print("watching rednet messages") | |
29 | ||
30 | while true do | |
31 | ||
32 | local senderId, message, protocal = rednet.receive() | |
33 | ||
34 | glass.clear() | |
35 | ||
36 | addBox() | |
37 | ||
38 | timeDis(message) | |
39 | ||
40 | glass.sync() | |
41 | ||
42 | sleep(0.1) | |
43 | ||
44 | end | |
45 | ||
46 | end | |
47 | ||
48 | start() |