tag-reader: update to pi-rc522 2.1

This version of pi-rc522 gives us a wait_for_tag() method,
greatly reducing CPU usage.
This commit is contained in:
Annika Backstrom 2017-04-08 01:55:34 +00:00
parent 39fd4018f6
commit e5c4923609
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,7 @@
pi-rc522==1.1.0
appdirs==1.4.3
packaging==16.8
pi-rc522==2.1.0
pyparsing==2.2.0
RPi.GPIO==0.6.3
SPI-Py==1.0
six==1.10.0
spidev==3.2

View File

@ -3,11 +3,21 @@ from pirc522 import RFID
import RPi.GPIO as GPIO
import sys
import signal
GPIO.setwarnings(False)
rdr = RFID()
def sigint_handler(signal, frame):
rdr.cleanup()
sys.exit(0)
signal.signal(signal.SIGINT, sigint_handler)
signal.signal(signal.SIGTERM, sigint_handler)
while True:
rdr.wait_for_tag()
(error, tag_type) = rdr.request()
if not error:
(error, uid) = rdr.anticoll()