This commit is contained in:
navid.sassan 2021-04-02 16:40:20 +02:00
parent bafcdb7ff6
commit d5b0bf5d25

View File

@ -23,6 +23,7 @@ function poll()
while true do while true do
if redstone_toggle_id ~= nil then if redstone_toggle_id ~= nil then
rednet.send(redstone_toggle_id, "get_state") rednet.send(redstone_toggle_id, "get_state")
print('sent poll')
end end
if de_store_mon_id ~= nil then if de_store_mon_id ~= nil then
-- todo -- todo
@ -34,6 +35,7 @@ end
function recv() function recv()
while true do while true do
local id, data = rednet.receive() local id, data = rednet.receive()
print("Message from " .. id .. ": " .. dump(data))
if id == redstone_toggle_id then if id == redstone_toggle_id then
if type(data) == 'table' then if type(data) == 'table' then
if data[1] == 'output_state' then if data[1] == 'output_state' then
@ -66,7 +68,7 @@ function draw_screen()
end end
print() print()
term.setBackgroundColor(colors.black) term.setBackgroundColor(colors.black)
sleep(3) sleep(1)
end end
end end
@ -81,5 +83,6 @@ end
rednet.open(modemSide) rednet.open(modemSide)
rednet.host("rmm", "master") rednet.host("rmm", "master")
parallel.waitForAny(poll, recv, draw_screen) -- parallel.waitForAny(poll, recv, draw_screen)
parallel.waitForAny(poll, recv)
rednet.close(modemSide) rednet.close(modemSide)