Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Reactors control Switch V1.0--
- local modem = peripheral.wrap("bottom") -- Modem position --
- modem.open(65001) --Open channel 65001 so that we can listen on it --
- local c = 0
- while true do
- print(""..c)
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if message=="on1" then
- c = colors.combine(c, colours.blue)
- redstone.setBundledOutput("top", c)
- print("Start R1 requested")
- modem.transmit(65002, 65001, "1on")
- end
- if message=="off1" then
- c = colors.subtract(c, colours.blue)
- redstone.setBundledOutput("top", c)
- print("Stop R1 requested")
- sleep(1)
- modem.transmit(65002, 65001, "1off")
- end
- if message=="on2" then
- c = colors.combine(c, colours.green)
- redstone.setBundledOutput("top", c)
- print("Start R2 requested")
- modem.transmit(65002, 65001, "2on")
- end
- if message=="off2" then
- c = colors.subtract(c, colours.green)
- redstone.setBundledOutput("top", c)
- print("Stop R2 requested")
- sleep(2)
- modem.transmit(65002, 65001, "2off")
- end
- if message=="on3" then
- c = colors.combine(c, colours.yellow)
- redstone.setBundledOutput("top", c)
- print("Start R3 requested")
- modem.transmit(65002, 65001, "3on")
- end
- if message=="off3" then
- c = colors.subtract(c, colours.yellow)
- redstone.setBundledOutput("top", c)
- print("Stop R3 requested")
- sleep(3)
- modem.transmit(65002, 65001, "3off")
- end
- if message=="on4" then
- c = colors.combine(c, colours.purple)
- redstone.setBundledOutput("top", c)
- print("Start R4 requested")
- modem.transmit(65002, 65001, "4on")
- end
- if message=="off4" then
- c = colors.subtract(c, colours.purple)
- redstone.setBundledOutput("top", c)
- print("Stop R4 requested")
- sleep(4)
- modem.transmit(65002, 65001, "4off")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement