daily pastebin goal
50%
SHARE
TWEET

oil.lua

a guest Jul 13th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local net = peripheral.find("modem")
  2. local chan = 2000
  3. local nchan = 1999
  4.  
  5. function supersosik()
  6.    
  7.     local event, modemSide, senderChannel, replyChannel, message, distance = os.pullEvent("modem_message")
  8.    
  9.     if message == "on" then
  10.         rs.setAnalogOutput("bottom", 1)
  11.         net.transmit(nchan, nchan, "Answer from station: \nStarted pumping")
  12.     elseif message == "off" then
  13.         rs.setAnalogOutput("bottom", 0)
  14.         net.transmit(nchan, nchan, "Answer from station: \nStopped")
  15.     else
  16.         net.transmit(nchan, nchan, "Answer from oil station: \nUnknown command")
  17.     end
  18. end
  19.  
  20. while true do
  21.  
  22. if net.isOpen(chan) then
  23.     supersosik()
  24. else
  25.     net.open(chan)
  26.     supersosik()
  27. end    
  28.  
  29. end
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
 
Top