Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("front")
- rednet.open("bottom")
- connections = 0
- waitTimer = 0
- reboot = false
- term.clear()
- term.setCursorPos(1,1)
- function RunClient ()
- while reboot == false do
- local wire = {}
- wire[1] = rs.testBundledInput("top", colors.white)
- wire[2] = rs.testBundledInput("top", colors.orange)
- wire[3] = rs.testBundledInput("top", colors.magenta)
- wire[4] = rs.testBundledInput("top", colors.lightBlue)
- wire[5] = rs.testBundledInput("top", colors.yellow)
- wire[6] = rs.testBundledInput("top", colors.lime)
- wire[7] = rs.testBundledInput("top", colors.pink)
- wire[8] = rs.testBundledInput("top", colors.gray)
- wire[9] = rs.testBundledInput("top", colors.lightGray)
- wire[10] = rs.testBundledInput("top", colors.cyan)
- wire[11] = rs.testBundledInput("top", colors.purple)
- wire[12] = rs.testBundledInput("top", colors.blue)
- wire[13] = rs.testBundledInput("top", colors.brown)
- wire[14] = rs.testBundledInput("top", colors.green)
- wire[15] = rs.testBundledInput("top", colors.red)
- wire[16] = rs.testBundledInput("top", colors.black)
- wire[17] = rs.testBundledInput("right", colors.white)
- wire[18] = rs.testBundledInput("right", colors.orange)
- wire[19] = rs.testBundledInput("right", colors.magenta)
- wire[20] = rs.testBundledInput("right", colors.lightBlue)
- wire[21] = rs.testBundledInput("right", colors.yellow)
- wire[22] = rs.testBundledInput("right", colors.lime)
- wire[23] = rs.testBundledInput("right", colors.pink)
- wire[24] = rs.testBundledInput("right", colors.gray)
- wire[25] = rs.testBundledInput("right", colors.lightGray)
- wire[26] = rs.testBundledInput("right", colors.cyan)
- wire[27] = rs.testBundledInput("right", colors.purple)
- wire[28] = rs.testBundledInput("right", colors.blue)
- wire[29] = rs.testBundledInput("right", colors.brown)
- wire[30] = rs.testBundledInput("right", colors.green)
- wire[31] = rs.testBundledInput("right", colors.red)
- wire[32] = rs.testBundledInput("right", colors.black)
- rednet.broadcast(wire, "percentprotocol")
- waitTimer = 0
- connections = connections+1
- print("Client sending data... "..connections)
- sleep(2)
- end
- rednet.broadcast("reboot", "rebootprotocol")
- term.clear()
- print("REBOOTING!!")
- sleep(4)
- os.reboot()
- end
- function RebootHandler()
- while reboot == false do
- print("RebootHandler waiting...")
- modem.open(48745)
- data = {os.pullEvent("modem_message")}
- msg = data[5]
- if msg == "reboot" then
- print("Reboot command recieved")
- reboot = true
- else
- term.setTextColor( colors.red )
- print("Invalid command")
- print("--------- Data -----------")
- print("Event : "..data[1])
- print("Side : "..data[2])
- print("Channel : "..data[3])
- print("Return : "..data[4])
- print("Message : "..data[5])
- print("Distance : "..data[6])
- print("---- End Transmission ----")
- term.setTextColor( colors.white )
- end
- end
- end
- parallel.waitForAll(RebootHandler, RunClient)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement