Advertisement
poudi7

Untitled

Oct 23rd, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. detecte = false
  2. needsleep = false
  3. reader = peripheral.wrap("top")
  4.  
  5. while true do
  6. reader.scan(5)
  7. detecte = false
  8. while true do
  9. event, message = os.pullEvent()
  10. if event == "rfid_detected" then
  11. if message == "ftbpoudi7mc" then
  12. detecte = true
  13. rs.setOutput("left",true)
  14. needsleep = true
  15. end
  16. elseif event == "rfid_scan_done" then
  17. if detecte == false then
  18. if needsleep == true then
  19. sleep(2)
  20. needsleep = false
  21. end
  22. rs.setOutput("left",false)
  23. end
  24. break
  25. end
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement