Here are my current codes
main code
rednet.open("top")
local engine_state = false
local buffer_state = false
mon = peripheral.wrap("back")
while true do
event, id, message = os.pullEvent("rednet_message")
if message == "engines on" then
engine_state = true
elseif message == "engines off" then
engine_state = false
elseif message == "Buffer: Drain" then
buffer_state = true
elseif message == "Buffer: Retain" then
buffer_state = false
end
mon.clear()
mon.setCursorPos(5,5)
if engine_state == true then
mon.write("Engines: On")
else
mon.write("Engines: Off")
end
mon.setCursorPos(60,5)
if buffer_state == true then
mon.write("Buffer: Drain")
else
mon.write("Buffer: Retain")
end
end
Engine send code
rednet.open("left")
while true do
shell.run("clear")
if rs.getInput ("back") then
rednet.broadcast("engines on")
else
rednet.broadcast("engines off")
end
os.pullEvent("redstone")
end
Buffer send code
rednet.open("top")
while true do
shell.run("clear")
if rs.getInput ("front") then
rednet.broadcast(21,"buffer drain")
else
rednet.broadcast(21,"buffer retain")
end
os.pullEvent("redstone")
end
end