Comments (5)
In pirc522/rfid.py, lines 191 and 221, we have the corresponding code.
print("E1")
so we have
print("E1", file=sys.stderr)
should be
from pi-rc522.
I have a similar problem, sometimes I read a tag and I get "E2" error, I tried to read the code but I have no Idea what the reason is.
Can someone help me please?
Thank you
from pi-rc522.
There are several ways to solve this, but if you do not want to rewrite lines 191 and 221 of the library, you can use
You can use redirect_stdout.
In Python 3.5 or later, this can be achieved as follows:
import io
import os
from contextlib import redirect_stdout
from pirc522 import RFID
rdr = RFID()
f = io.StringIO()
while True:
rdr.wait_for_tag()
with redirect_stdout(f):
(error, tag_type) = rdr.request()
# print(f.getvalue()) # if need print "E1" or "E2"
if not error:
print("Tag detected")
with redirect_stdout(f):
(error, uid) = rdr.anticoll()
# print(f.getvalue()) # if need print "E1" or "E2"
if not error:
print("UID: " + str(uid))
# Calls GPIO cleanup
rdr.cleanup()
If you do not need to capture E1 and E2, you can use
f = open(os.devnull,'w')
instead of
f = io.StringIO()
.
from pi-rc522.
Hi nanbuwks,
thank you for the answer, but I'm more interested in knowing why the error occours (and maybe solve or manage it) than suppress the message.
from pi-rc522.
Since we are using radio waves, there will always be errors at the boundary of the reaction.
However, aren't you plagued by a large number of errors?
When I used such a module as it is, it was quite unstable as shown below.
Detected
Card read UID: 242,195,43,51
Selecting UID [242, 195, 43, 51, 41].
Changing used auth key to [255, 255, 255, 255, 255, 255] using method B
Calling card_auth on UID [242, 195, 43, 51, 41].
E2
Error on S1.0B0
Not calling card_auth - already authed
S1.0B0: [2] B
Calling card_auth on UID [242, 195, 43, 51, 41].
Error on S1.0B2
Changing used auth key to [255, 255, 255, 255, 255, 255] using method A
Calling card_auth on UID [242, 195, 43, 51, 41].
Not calling card_auth - already authed
Not calling card_auth - already authed
S2.0B1: []
Calling card_auth on UID [242, 195, 43, 51, 41].
Error on S0.0B0
Calling card_auth on UID [242, 195, 43, 51, 41] Error on S0.0B0
Error on S0.0B1
Calling card_auth on UID [242, 195, 43, 51, 41] Error on S0.0B1
Error on S0.0B2
.
.
.
Calling card_auth on UID [242, 195, 43, 51, 41]
Error on S15.0B2
Calling card_auth on UID [242, 195, 43, 51, 41] Error on S15.0B2
Error on S15.0B3
Changing auth key and method to None
To solve this problem, adding a capacitor was effective.
In the picture, a 47μF capacitor has been installed to improve the 3.3V power supply.
from pi-rc522.
Related Issues (20)
- OLED with RFID HOT 1
- Read fails after some time HOT 8
- how to write the UID? HOT 1
- how to write the UID? HOT 2
- get_access_bits function not callable HOT 1
- continous reading fails after 16-20 reads HOT 1
- stuck at wait_for_tag() HOT 11
- what pin can I remove? HOT 1
- Cannot import on Beaglebone
- Errno 2 directory does not exist HOT 8
- KeyChange
- How can use the SPI1 ? HOT 1
- How to reduce electromagnetic emissions? HOT 1
- Reader not reading certain Card HOT 3
- New release on pypi possible? HOT 2
- pi-rc522 not working with spidev 3.5 HOT 1
- SPI1 instead of SPI0
- Reader not reading HOT 2
- rdr.auth_a Write not work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pi-rc522.