Open xetum opened 3 years ago
You can put it inside of a loop such as in the simpletest example here: https://github.com/adafruit/Adafruit_CircuitPython_PN532/blob/master/examples/pn532_simpletest.py
If if it does not find a card it will just keep retrying until one is in range.
The relavent code in that example is at the bottom:
print("Waiting for RFID/NFC card...")
while True:
# Check if a card is available to read
uid = pn532.read_passive_target(timeout=0.5)
print(".", end="")
# Try again if no card is available.
if uid is None:
continue
print("Found card with UID:", [hex(i) for i in uid])
Yes I know, I was trying to do it without the polling loop, as with other libraries
El dom., 4 oct. 2020 20:01, foamyguy notifications@github.com escribió:
You can put it inside of a loop such as in the simpletest example here: https://github.com/adafruit/Adafruit_CircuitPython_PN532/blob/master/examples/pn532_simpletest.py
If if it does not find a card it will just keep retrying until one is in range.
The relavent code in that example is at the bottom:
print("Waiting for RFID/NFC card...")while True:
Check if a card is available to read
uid = pn532.read_passive_target(timeout=0.5) print(".", end="") # Try again if no card is available. if uid is None: continue print("Found card with UID:", [hex(i) for i in uid])
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_CircuitPython_PN532/issues/43#issuecomment-703292403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3DJB6L5J2JY465JWYNZ4DSJCZ7BANCNFSM4SD2SLHA .
In the arduino library there is a comment that mentions using a timeout of 0 will make it wait forever.
Did you try setting timeout=0
in the CircuitPython one? Maybe it will work the same.
Ok, I'll try
El dom., 4 oct. 2020 21:05, foamyguy notifications@github.com escribió:
In the arduino library there is a comment that mentions using a timeout of 0 will make it wait forever.
Did you try setting timeout=0 in the CircuitPython one? Maybe it will work the same.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_CircuitPython_PN532/issues/43#issuecomment-703300914, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3DJBZ65AZ76XRA6OYEEGLSJDBQBANCNFSM4SD2SLHA .
No, timeout=0 does polling. I think it could be added to the library, even more so the arduino version does blocking. Regards, Francesc
El dom., 4 oct. 2020 21:12, Francesc Oller Teijon francesc.oller@upc.edu escribió:
Ok, I'll try
El dom., 4 oct. 2020 21:05, foamyguy notifications@github.com escribió:
In the arduino library there is a comment that mentions using a timeout of 0 will make it wait forever.
Did you try setting timeout=0 in the CircuitPython one? Maybe it will work the same.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_CircuitPython_PN532/issues/43#issuecomment-703300914, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3DJBZ65AZ76XRA6OYEEGLSJDBQBANCNFSM4SD2SLHA .
Other libraries have this possibility. I don't see how in this one. Thanks