Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function Pulse()
- redstone.setOutput("back", not redstone.getOutput("back"))
- end
- local function Pulse2()
- redstone.setOutput("right", not redstone.getOutput("right"))
- end
- function bool_to_number(value)
- return value and 1 or 0
- end
- local modem = peripheral.find("modem")
- local event, side, channel, replyChannel, message, distance
- modem.open(43)
- while true do
- event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
- if message == "swap" then
- Pulse()
- modem.transmit(replyChannel, 43, redstone.getOutput("back"))
- end
- if message == "stop" then
- Pulse2()
- modem.transmit(replyChannel, 43, bool_to_number(redstone.getOutput("right")) + 2)
- end
- print(message)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement