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

Cleanups #78

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions Dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# along with MFRC522-Python. If not, see <http://www.gnu.org/licenses/>.
#

import RPi.GPIO as GPIO
import MFRC522
import signal

Expand All @@ -30,9 +29,8 @@
# Capture SIGINT for cleanup when the script is aborted
def end_read(signal,frame):
global continue_reading
print "Ctrl+C captured, ending read."
print("Ctrl+C captured, ending read.")
continue_reading = False
GPIO.cleanup()

# Hook the SIGINT
signal.signal(signal.SIGINT, end_read)
Expand All @@ -42,26 +40,26 @@ def end_read(signal,frame):

# This loop keeps checking for chips. If one is near it will get the UID and authenticate
while continue_reading:
# Scan for cards

# Scan for cards
(status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)

# If a card is found
if status == MIFAREReader.MI_OK:
print "Card detected"
print("Card detected")

# Get the UID of the card
(status,uid) = MIFAREReader.MFRC522_Anticoll()

# If we have the UID, continue
if status == MIFAREReader.MI_OK:

# Print UID
print "Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3])
print("Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3]))

# This is the default key for authentication
key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]

# Select the scanned tag
MIFAREReader.MFRC522_SelectTag(uid)

Expand Down
Loading