-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I make read_passive_target wait indefinitely until a tag becomes available? #43
Comments
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 <[email protected]> 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
<#43 (comment)>,
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 |
Ok, I'll try
El dom., 4 oct. 2020 21:05, foamyguy <[email protected]> escribió:
…
https://github.com/adafruit/Adafruit-PN532/blob/d988fb4a28e54efe4de638883ce00858064ddf5f/Adafruit_PN532.h#L173
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
<#43 (comment)>,
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 <[email protected]>
escribió:
… Ok, I'll try
El dom., 4 oct. 2020 21:05, foamyguy ***@***.***> escribió:
>
> https://github.com/adafruit/Adafruit-PN532/blob/d988fb4a28e54efe4de638883ce00858064ddf5f/Adafruit_PN532.h#L173
>
> 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
> <#43 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AB3DJBZ65AZ76XRA6OYEEGLSJDBQBANCNFSM4SD2SLHA>
> .
>
|
Other libraries have this possibility. I don't see how in this one. Thanks
The text was updated successfully, but these errors were encountered: