Skip to content
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

Reader appears to not read in thread #50

Open
Grandpa-G opened this issue Apr 2, 2022 · 1 comment
Open

Reader appears to not read in thread #50

Grandpa-G opened this issue Apr 2, 2022 · 1 comment

Comments

@Grandpa-G
Copy link

Grandpa-G commented Apr 2, 2022

Using python3 - a simple read works outside the thread but not inside. This is in a Flask script - I will try a simple thread example as well.

Update - this problem appears to be related to running in Flask

More Update - I got this to work by just adding the instantiation statement in the main thread. The when the rfid thread was setup, the code below worked. I have no idea why.

This is the cocde

` self.reader = SimpleMFRC522()

   print(self.reader)

   while True:

      id, text = self.reader.read()

      print("The ID for this card is:", id)

      print(id)

      sleep(1)

`

@shrewdlogarithm
Copy link

shrewdlogarithm commented May 17, 2022

I've run into this exact same issue but I've not found a reliable workaround

It seems this library just does not work in a thread which isn't ideal!?

If I instantiate the reader as per the above post, it does read 'sometimes' - it appears to read a card about once every few minutes (even if you leave the card on the reader) and it appears to slow-down the entire Pi whilst it's running in that way...

I'm going to have to switch to a proprietary reader - this just isn't fit-for-purpose - a warning on the Wiki page will save others wasting their time here...

p.s. There is a consolidated RC522 library which does seem to work in threads/on later PIs etc. here

https://github.com/STEMinds/RC522-Python

That works for me multithreaded - may help someone else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants