2021-08-16
                    
NFC, Python, Raspberrypi, Sensor
                
nfc raspberrypi tag id matching
ximport nfcimport timemy_id = '01010501b00ac30b'
def connected (tag):    time.sleep(1)    clf = nfc.ContactlessFrontend('usb')touched = 0
while True:    print('waiting...')    tag = clf.connect(rdwr={'on-connect':connected})    felica_id = str(tag.idm).encode("hex")    if (my_id == felica_id):        print('matched!!')    else:        print('invalid id!!')            print('scaned')
で,
指定したfelica(=my_id)だと,
xxxxxxxxxxwaiting...matched!!scanedwaiting...
違うfelicaだと,
xxxxxxxxxxwaiting...invalid id!!scanedwaiting...
となる.




