SHARE
TWEET

Untitled

a guest Jan 24th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from time import sleep
  2. import sys
  3. from mfrc522 import SimpleMFRC522
  4. import RPi.GPIO as GPIO
  5. import database
  6.  
  7.  
  8. if __name__ == "__main__":
  9.     reader = SimpleMFRC522()
  10.     users = database.Database("user.db")
  11.     GPIO.cleanup()
  12.  
  13.     try:
  14.         while True:
  15.             print("Chip auflegen")
  16.             id, text = reader.read()
  17.  
  18.             current_user = users.onlyoneuser(id)
  19.  
  20.             if current_user is None:
  21.                 print("User-ID existiert nicht. Soll dieser User angelegt werden?")
  22.             elif current_user[0] == id and current_user[-1] == 1:
  23.                 print("Zugang zu Templates für 30 Sekunden erteilt")
  24.                 sleep(30)
  25.             elif current_user[0] == id and current_user[-1] == 0:
  26.                 print("Zugang verweigert. Melden Sie sich beim Administrator")            
  27.  
  28.             sleep(5)
  29.     except KeyboardInterrupt:
  30.         GPIO.cleanup()
  31.         print("Programm beendet")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top