Advertisement
RadioNurshat

MotionOpener

Mar 5th, 2017
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. local component = require('component')
  2. local motion = component.motion_sensor
  3. local event = require('event')
  4. local redstone = component.redstone
  5. local evlistener = {}
  6.  
  7. local function setDoorState(isOpened)
  8. for address in component.list("redstone") do component.proxy(address).setOutput(1, isOpened and 15 or 0)
  9. end
  10. end
  11.  
  12. while true do
  13. os.sleep(1)
  14. evlistener = {event.pull()}
  15.  
  16.  
  17. if evlistener[6] == "ThisJoda" or evlistener[6] == "KirillKot" then
  18. setDoorState(true)
  19. os.sleep(3)
  20. setDoorState(false)
  21. end
  22.  
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement