forked from minebuild3543/CC-EAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoder
More file actions
35 lines (32 loc) · 612 Bytes
/
decoder
File metadata and controls
35 lines (32 loc) · 612 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function openModems()
for _, v in pairs(rs.getSides()) do
if peripheral.getType(v) == "modem" then
rednet.open(v)
end
end
end
function react(msg)
print(msg)
pulse(10, "back")
end
function pulse(sec, side)
local num = sec
while true do
local oldNum = num
redstone.setOutput(side,true)
sleep(0.5)
redstone.setOutput(side,false)
sleep(0.5)
num = oldNum - 1
if num == 0 then break end
end
end
openModems()
term.clear()
term.setCursorPos(1, 1)
print("EAS Decoder v1.0")
print("Starting EAS decoder")
while true do
senderId, message, protocol = rednet.receive("easp")
react(message)
end