-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNfc.py
More file actions
37 lines (34 loc) · 677 Bytes
/
Nfc.py
File metadata and controls
37 lines (34 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from time import sleep
def reconocer(nfcReconocer,ser):
i = 0
ser.write(b'2')
ser.flushInput()
while True:
ard=ser.readline()
if(str(ard).startswith("b'UID:")):
texto = str(ard).split(": ")[1]
texto = str(texto).split("\\")[0]
UID = texto
print(UID)
if(UID == nfcReconocer):
return True
else:
i+=1
if(i == 3):
return False
print(ard)
def registrar(ser):
texto = ""
ser.write(b'1')
ser.write(b'0')
ser.flushInput()
while True:
ard=ser.readline()
if(str(ard).startswith("b'UID:")):
texto = str(ard).split(": ")[1]
texto = str(texto).split("\\")[0]
UID = texto
print(UID)
return UID
print(ard)
sleep(1)