Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- logging.basicConfig()
- import sys
- import time
- import errno
- import nfc
- def connected(tag):
- print(tag)
- return True
- def connect_reader(path):
- while True:
- try:
- return nfc.ContactlessFrontend(path)
- except IOError as error:
- time.sleep(0.5)
- continue
- if __name__ == '__main__':
- while True:
- try:
- clf = connect_reader("usb")
- except KeyboardInterrupt:
- sys.exit()
- try:
- clf.connect(rdwr={'on-connect': connected})
- finally:
- clf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement