testing
This commit is contained in:
		
							parent
							
								
									71831d464d
								
							
						
					
					
						commit
						2eb429d0ce
					
				@ -1,6 +1,5 @@
 | 
			
		||||
redstone_toggle_id = 48
 | 
			
		||||
de_store_mon_id = nil
 | 
			
		||||
redstone_toggle_state = nil
 | 
			
		||||
 | 
			
		||||
function dump(o)
 | 
			
		||||
    if o == nil then
 | 
			
		||||
@ -32,22 +31,22 @@ function poll()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function recv()
 | 
			
		||||
    local redstone_toggle_state = nil
 | 
			
		||||
    local updated = false
 | 
			
		||||
    while true do
 | 
			
		||||
        local id, data = rednet.receive()
 | 
			
		||||
        if id == redstone_toggle_id then
 | 
			
		||||
            if type(data) == 'table' then
 | 
			
		||||
                if data[1] == 'output_state' then
 | 
			
		||||
                    redstone_toggle_state = data[2]
 | 
			
		||||
                    updated = true
 | 
			
		||||
                end
 | 
			
		||||
            end
 | 
			
		||||
        elseif id == de_store_mon_id then
 | 
			
		||||
            -- todo
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function draw_screen()
 | 
			
		||||
    while true do
 | 
			
		||||
        if updated == true then
 | 
			
		||||
            print(tostring(redstone_toggle_state))
 | 
			
		||||
            -- term.clear()
 | 
			
		||||
            -- term.setCursorPos(0, 0)
 | 
			
		||||
@ -70,6 +69,7 @@ function draw_screen()
 | 
			
		||||
            sleep(1)
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local sides = peripheral.getNames()
 | 
			
		||||
for i = 1, #sides do
 | 
			
		||||
@ -82,5 +82,5 @@ end
 | 
			
		||||
rednet.open(modemSide)
 | 
			
		||||
rednet.host("rmm", "master")
 | 
			
		||||
 | 
			
		||||
parallel.waitForAny(poll, recv, draw_screen)
 | 
			
		||||
parallel.waitForAny(poll, recv)
 | 
			
		||||
rednet.close(modemSide)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user