Advertisement
Alakazard12

CC1 - DoorLock-Client

May 15th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. -- ARE YOU SERIOUSLY TRYING TO BREAK IN?
  2.  
  3. local server = 108
  4. rednet.open("back")
  5.  
  6. local p = peripheral.wrap("top")
  7.  
  8. while true do
  9.   p.setInsertCardLight(true)
  10.   local event, p1 = os.pullEventRaw("mag_swipe")
  11.   rednet.send(server, "checkSwipe:" .. p1)
  12.   local id, message
  13.   repeat
  14.     id, message = rednet.receive()
  15.   until id == server
  16.   if message == "true" then
  17.     p.setInsertCardLight(false)
  18.     rs.setOutput("left", true)
  19.     sleep(2)
  20.     rs.setOutput("left", false)
  21.   end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement