lego11

Untitled

Jul 3rd, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. lettore = peripheral.wrap("top")
  2. codeScheda = "Ale041"
  3. portaAperta = 0
  4.  
  5. term.clear()
  6. term.setCursorPos(1,1)
  7.  
  8.  
  9. function controllaPorta()
  10. if portaAperta == 0 then
  11. rs.setOutput("back", false)
  12. elseif portaAperta == 1 then
  13. rs.setOutput("back", true)
  14. end
  15. end
  16. while true do
  17. scanner.scan(2)
  18. event, data = os.pullEvent()
  19. if event == "rfid_detected" and data == codiceScheda then
  20. opendoor = 1
  21. else
  22. opendoor = 0
  23. end
  24. controllaPorta()
  25. sleep (0.1)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment