testing
This commit is contained in:
parent
d5b0bf5d25
commit
71831d464d
@ -23,7 +23,6 @@ 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
|
||||||
@ -35,7 +34,6 @@ 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
|
||||||
@ -50,24 +48,25 @@ end
|
|||||||
|
|
||||||
function draw_screen()
|
function draw_screen()
|
||||||
while true do
|
while true do
|
||||||
term.clear()
|
print(tostring(redstone_toggle_state))
|
||||||
term.setCursorPos(0, 0)
|
-- term.clear()
|
||||||
term.setTextColor(colors.white)
|
-- term.setCursorPos(0, 0)
|
||||||
term.setBackgroundColor(colors.black)
|
-- term.setTextColor(colors.white)
|
||||||
print('Press "R" to toggle the rainbows')
|
-- term.setBackgroundColor(colors.black)
|
||||||
term.write('Rainbows state: ')
|
-- print('Press "R" to toggle the rainbows')
|
||||||
if redstone_toggle_state == true then
|
-- term.write('Rainbows state: ')
|
||||||
term.setBackgroundColor(colors.green)
|
-- if redstone_toggle_state == true then
|
||||||
term.write('On')
|
-- term.setBackgroundColor(colors.green)
|
||||||
elseif redstone_toggle_state == false then
|
-- term.write('On')
|
||||||
term.setBackgroundColor(colors.red)
|
-- elseif redstone_toggle_state == false then
|
||||||
term.write('Off')
|
-- term.setBackgroundColor(colors.red)
|
||||||
elseif redstone_toggle_state == nil then
|
-- term.write('Off')
|
||||||
term.setBackgroundColor(colors.purple)
|
-- elseif redstone_toggle_state == nil then
|
||||||
term.write('Unknown')
|
-- term.setBackgroundColor(colors.purple)
|
||||||
end
|
-- term.write('Unknown')
|
||||||
print()
|
-- end
|
||||||
term.setBackgroundColor(colors.black)
|
-- print()
|
||||||
|
-- term.setBackgroundColor(colors.black)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -83,6 +82,5 @@ 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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user