#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''
Lecture de l'UID d'un tag RFID au moyen
d'un module RC522.

Utilisation de la bibliothèque pi-rc522.

Plus de détails:

https://electroniqueamateur.blogspot.com/2017/04/module-rfid-rc522-et-raspberry-pi-python.html

'''

from pirc522 import RFID
import time

rc522 = RFID()

while True:
  rc522.wait_for_tag()
  (error, tag_type) = rc522.request()
  if not error:
    (error, uid) = rc522.anticoll()
    if not error:
      print("UID: " + str(uid))
      time.sleep(1)