VicyX

ComputercraftVaultRecieve

May 18th, 2021 (edited)
648
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Modem = peripheral.wrap('bottom')
  2. local Togg = false
  3.  
  4. function Open()
  5.     redstone.setOutput('left', true)
  6.     sleep(2)
  7.     redstone.setOutput('right', true)
  8.     sleep(5)
  9. end
  10.  
  11. function Close()
  12.     redstone.setOutput('right', false)
  13.     sleep(2)
  14.     redstone.setOutput('left', false)
  15.     sleep(5)
  16. end
  17.  
  18. while true do
  19.     Modem.open(1)
  20.     local _, side, freq, rfreq, message = os.pullEvent('modem_message')
  21.     if freq == 1 and message == 'OK' then
  22.         if Togg == false then
  23.             Open()
  24.             Togg = true
  25.         else
  26.             Close()
  27.             Togg = false
  28.         end
  29.     end
  30.     sleep(.5)
  31. end
RAW Paste Data