carrots084

Database CPU

Jan 27th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for a,b in pairs(rs.getSides()) do
  2.     if peripheral.getType(b) == "modem" then
  3.         rednet.open(b)
  4.         break
  5.     end
  6. end
  7.  
  8. function _setOuput(side)
  9.     rs.setOutput(side, true)
  10.     sleep(1)
  11.     rs.setOutput(side, false)
  12. end
  13.  
  14. while true do
  15.  
  16.     id, message, protocol = rednet.receive()
  17.     if protocol == "SarasMessage Protocol" then
  18.         if message == "SET_TO_DAY" then
  19.             print("Setting to day")
  20.             rednet.send(id, "Message Received", "ResponseProtocol1")
  21.             _setOutput("left")
  22.         else if message == "SET_TO_CLEAR" then
  23.             print("Setting the weather to clear")
  24.             rednet.send(id, "Message Received", "ResponseProtocol1")
  25.             _setOutput("right")
  26.         end
  27.     end
  28. end
  29. end
Add Comment
Please, Sign In to add comment