Script.py 373 B

12345678910111213141516171819202122232425262728
  1. !/usr/bin/env python
  2. import RPi.GPIO as GPIO
  3. from mfrc522 import SimpleMFRC522
  4. reader = SimpleMFRC522()
  5. try:
  6. id, text = reader.read()
  7. print(id)
  8. print(text)
  9. print(type(id))
  10. id_str = str(id)
  11. chemin = '/home/prismx/rc522/fichier.txt'
  12. f = open(chemin, 'r')
  13. texte = f.readlines()
  14. if (id_str+'\n') in texte:
  15. print(id)
  16. finally:
  17. GPIO.cleanup()