Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function clearScreen()
- term.clear()
- term.setCursorPos(1, 1)
- end
- -- Set the side of the computer where the redstone signal will be emitted (change 'back' if needed)
- local side = "back"
- redstone.setOutput(side, true)
- -- Prompt the player to press enter to start
- print("Press Enter to start emitting the redstone signal.")
- while true do
- local event, key = os.pullEvent("key")
- if event == "key" and key == keys.enter then
- break
- end
- end
- clearScreen()
- -- Activate the redstone output
- redstone.setOutput(side, false)
- print("Redstone signal activated.")
- local modem = peripheral.find("modem") or error("No modem attached", 0)
- modem.open(92) -- Open 43 so we can receive replies
- -- And wait for a reply
- local event, side, channel, replyChannel, message, distance
- repeat
- event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
- until channel == 92
- -- Deactivate the redstone output after the duration
- redstone.setOutput(side, true)
- print("Redstone signal deactivated.")
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement