Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("bottom")
- rednet.open("top")
- rednet.open("back")
- rednet.open("front")
- rednet.open("right")
- rednet.open("left")
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function receive()
- clear()
- print("Wireless Redstone v0.1 \n \n Choose a side \n")
- input = read()
- if input == "left" or input == "front" or input == "back" or input == "top" or input == "bottom" or input == "right" then
- print("Waiting...")
- print("ID:" ..os.getComputerID)
- while true do
- id, message = rednet.receive()
- if message == "activate" then
- rednet.setOutput(input, true)
- sleep(1)
- rednet.setOutput(input, false)
- end
- end
- else
- print("Invalid!")
- sleep(1)
- menu()
- end
- end
- function menu()
- clear()
- print("Wireless Redstone v0.1 \n \n 1. Receive \n 2. Send \n")
- write("Choose: ")
- input = read()
- if input == "1" or input == 1 then
- receive()
- elseif input == "2" or input == 2 then
- write("\n Enter a ID: ")
- id = tonumber(read())
- rednet.send(id, "activate")
- print("On!")
- sleep(1)
- print("Off!")
- sleep(0.8)
- menu()
- else
- menu()
- end
- end
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement