This commit is contained in:
danjperron
2021-02-09 22:20:54 -05:00
parent b628e61983
commit 77071b6fd3
2 changed files with 37 additions and 1 deletions

34
examples/Pico_read.py Normal file
View File

@@ -0,0 +1,34 @@
from mfrc522 import MFRC522
def uidToString(uid):
mystring = ""
for i in uid:
mystring = "%02X" % i + mystring
return mystring
reader = MFRC522(spi_id=0,sck=2,miso=4,mosi=3,cs=1,rst=0)
print("")
print("Place card before reader to read from address 0x08")
print("")
try:
while True:
(stat, tag_type) = reader.request(reader.REQIDL)
if stat == reader.OK:
(stat, uid) = reader.SelectTagSN()
if stat == reader.OK:
print("Card detected %s" % uidToString(uid))
else:
print("Authentication error")
except KeyboardInterrupt:
print("Bye")