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