LoginSignup
0
0

More than 5 years have passed since last update.

nfc raspberrypi tag id matching

Last updated at Posted at 2017-04-18
id_matching.py
import nfc
import time
my_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)だと,

waiting...
matched!!
scaned
waiting...

違うfelicaだと,

waiting...
invalid id!!
scaned
waiting...

となる.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0