-- redstoneremote.lua -- Remote redstone receiver via ender modem -- This runs on the remote computer that outputs redstone ------------- Config ------------- local CHANNEL = "redstone_1" -- communication channel (must match the control script) local REDSTONE_SIDE = "right" -- which side outputs the redstone signal --------------------------------- -- Open modem for _, side in ipairs(rs.getSides()) do if peripheral.getType(side) == "modem" then rednet.open(side) end end print("Redstone Remote active") print("Channel: '" .. CHANNEL .. "'") print("Waiting for commands...") print("My computer ID: " .. os.computerID()) -- Main loop while true do local id, msg, channel = rednet.receive(CHANNEL) if type(msg) == "table" and msg.action then if msg.action == "on" then redstone.setOutput(REDSTONE_SIDE, true) print("[" .. id .. "] Redstone ON") elseif msg.action == "off" then redstone.setOutput(REDSTONE_SIDE, false) print("[" .. id .. "] Redstone OFF") end end end