This commit is contained in:
navid.sassan 2021-04-02 16:47:50 +02:00
parent 2b05b43507
commit ac539f32d6

View File

@ -35,16 +35,11 @@ function recv()
local updated = false local updated = false
while true do while true do
local id, data = rednet.receive() local id, data = rednet.receive()
print(type(id))
if id == redstone_toggle_id then if id == redstone_toggle_id then
print('id')
print(type(data))
if type(data) == 'table' then if type(data) == 'table' then
print('table')
if data[1] == 'output_state' then if data[1] == 'output_state' then
redstone_toggle_state = data[2] redstone_toggle_state = data[2]
updated = true updated = true
print('updated')
end end
end end
elseif id == de_store_mon_id then elseif id == de_store_mon_id then
@ -52,25 +47,24 @@ function recv()
end end
if updated == true then if updated == true then
print(tostring(redstone_toggle_state)) term.clear()
-- term.clear() term.setCursorPos(0, 0)
-- term.setCursorPos(0, 0) term.setTextColor(colors.white)
-- term.setTextColor(colors.white) term.setBackgroundColor(colors.black)
-- term.setBackgroundColor(colors.black) print('Press "R" to toggle the rainbows')
-- print('Press "R" to toggle the rainbows') term.write('Rainbows state: ')
-- term.write('Rainbows state: ') if redstone_toggle_state == true then
-- if redstone_toggle_state == true then term.setBackgroundColor(colors.green)
-- term.setBackgroundColor(colors.green) term.write('On')
-- term.write('On') elseif redstone_toggle_state == false then
-- elseif redstone_toggle_state == false then term.setBackgroundColor(colors.red)
-- term.setBackgroundColor(colors.red) term.write('Off')
-- term.write('Off') elseif redstone_toggle_state == nil then
-- elseif redstone_toggle_state == nil then term.setBackgroundColor(colors.purple)
-- term.setBackgroundColor(colors.purple) term.write('Unknown')
-- term.write('Unknown') end
-- end print()
-- print() term.setBackgroundColor(colors.black)
-- term.setBackgroundColor(colors.black)
end end
end end
end end