daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. quit = false
  2. master = nil
  3.  
  4. rednet.open("top")
  5.  
  6. rednet.broadcast("NeedMaster!")
  7.  
  8. probes = sensors.getProbes("back", "Sensor")
  9. for i,v in ipairs(probes) do print(i,v) end
  10.  
  11. while not quit do
  12.     event, p1, p2, p3 = os.pullEvent()
  13.     if event == "rednet_message" then
  14.         sender = p1
  15.         message = p2
  16.         distance = p3
  17.  
  18.         if message == "NeedSensors!" or message == "AmMaster" then
  19.             master = sender
  20.             if message == "NeedSensors!" then
  21.                 rednet.send(master, "AmSensor")
  22.             end
  23.         elseif message == "Scan" and sender == master then
  24.                        
  25.         end
  26.     end
  27. end
  28.  
  29. rednet.close("top")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand