ondryaso / pi-rc522

Raspberry Pi Python library for SPI RFID RC522 module
MIT License
417 stars 149 forks source link

Add timeout to wait_for_tag method #70

Closed jo-me closed 1 year ago

jo-me commented 4 years ago

Based on @tlongeri 's suggestion in https://github.com/ondryaso/pi-rc522/issues/44 I addded the timeout functionality to the wait_for_tag method so that it will return after a given number of seconds. The timeout param is optional with default value of 0 (=no timeout) so that existing users of the library will not have any change in functionality unless they provide the new param.

This functionality is useful for detecting that the reader could not find a RFID tag, e.g. the card was removed.

jo-me commented 3 years ago

You're right. I updated the code to handle that case.

Jonathan-0101 commented 3 years ago

Hi how do I use this in my code?