testing
This commit is contained in:
parent
7ac1076e1d
commit
da2b8bd48f
@ -1,8 +1,5 @@
|
|||||||
local hostname = "redstone_toggle" .. os.getComputerID()
|
local hostname = "redstone_toggle" .. os.getComputerID()
|
||||||
|
|
||||||
output_state = redstone.getInput("back")
|
|
||||||
lever_state = redstone.getInput("top")
|
|
||||||
|
|
||||||
function dump(o)
|
function dump(o)
|
||||||
if o == nil then
|
if o == nil then
|
||||||
return ""
|
return ""
|
||||||
@ -53,7 +50,7 @@ function recv()
|
|||||||
print("Pong!")
|
print("Pong!")
|
||||||
rednet.send(master, "Pong!")
|
rednet.send(master, "Pong!")
|
||||||
elseif data == 'toggle' then
|
elseif data == 'toggle' then
|
||||||
output_state = !output_state
|
local output_state = !redstone.getInput("back")
|
||||||
redstone.setOutput("back", output_state)
|
redstone.setOutput("back", output_state)
|
||||||
print("Toggled output to: " .. output_state)
|
print("Toggled output to: " .. output_state)
|
||||||
rednet.send(master, "Toggled output to: " .. output_state)
|
rednet.send(master, "Toggled output to: " .. output_state)
|
||||||
@ -64,12 +61,15 @@ function recv()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function lever_input()
|
function lever_input()
|
||||||
|
local lever_state = redstone.getInput("top")
|
||||||
while true do
|
while true do
|
||||||
local new_lever_state = redstone.getInput("top")
|
local new_lever_state = redstone.getInput("top")
|
||||||
if new_lever_state != lever_state then
|
if new_lever_state != lever_state then
|
||||||
lever_state = new_lever_state
|
lever_state = new_lever_state
|
||||||
output_state = !output_state
|
local output_state = !redstone.getInput("back")
|
||||||
redstone.setOutput("back", output_state)
|
redstone.setOutput("back", output_state)
|
||||||
|
print("Toggled output to: " .. output_state)
|
||||||
|
rednet.send(master, "Toggled output to: " .. output_state)
|
||||||
end
|
end
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user