Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- local modem = peripheral.find("modem") or error("No modem attached", 0)
- local status = -1 -- -1 - null 0 - Off 1 - On
- modem.open(1)
- while true do
- local event, side, channel, replyChannel, message, distance
- repeat
- event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
- until channel == 1
- if status == -1 or (message < 0.5 and status == 0) then
- redstone.setOutput("back", true) -- Redstone on
- status = 1
- print("Reactor On")
- elseif status == -1 or (message > 0.8 and status == 1) then
- redstone.setOutput("back", false) -- Redstone off
- status = 0
- print("Reactor Off")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment