Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nfc
- import time
- import socket
- clf = nfc.ContactlessFrontend('tty')
- UDP_IP = "192.168.100.110"
- UDP_PORT = 5005
- from nfc.clf import RemoteTarget
- sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- def checkTag(records):
- message = records[0].text
- print message
- sock.sendto(message, (UDP_IP, UDP_PORT))
- time.sleep(5)
- main()
- def main():
- tag = clf.connect(rdwr={'on-connect': lambda tag: False})
- try:
- #assert tag.ndef is not None
- if tag.ndef.records != None:
- checkTag(tag.ndef.records)
- except:
- print("error")
- time.sleep(2)
- main()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement