Advertisement
Guest User

door

a guest
May 22nd, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. s = 0
  2.  
  3. while true do
  4.  
  5. if rs.getInput("front") == true then
  6.   --System On
  7.   print("got a signal")
  8.   if s == 0 then --door is closed
  9.     s = 1
  10.     rs.setOutput("right",true)
  11.     sleep(9)
  12.     rs.setOutput("back",true)
  13.   elseif s == 1 then --door is opened
  14.     s = 0
  15.     rs.setOutput("back",false)
  16.     rs.setOutput("right",false)
  17.     sleep(2)
  18.   end
  19. else
  20.   -- Waiting for signal
  21.   print("Waiting for signal")
  22.   sleep(1)
  23. end  
  24.  
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement