├── .gitignore ├── Dockerfile ├── Dump.py ├── LICENSE.txt ├── MFRC522.py ├── README.md ├── Read.py ├── Write.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | MFRC522.pyc 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM armv7/armhf-ubuntu 2 | RUN apt-get update && apt-get install -y \ 3 | python \ 4 | python-dev \ 5 | python-pip \ 6 | python-virtualenv \ 7 | python-setuptools \ 8 | gcc-multilib \ 9 | git \ 10 | ssh \ 11 | --no-install-recommends \ 12 | && pip install --upgrade pip \ 13 | && pip install wheel 14 | WORKDIR /usr/app 15 | COPY requirements.txt /usr/app 16 | RUN pip install -r requirements.txt 17 | COPY . /usr/app 18 | CMD python Read.py 19 | -------------------------------------------------------------------------------- /Dump.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf8 -*- 3 | # 4 | # Copyright 2014,2018 Mario Gomez 5 | # 6 | # This file is part of MFRC522-Python 7 | # MFRC522-Python is a simple Python implementation for 8 | # the MFRC522 NFC Card Reader for the Raspberry Pi. 9 | # 10 | # MFRC522-Python is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU Lesser General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # MFRC522-Python is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU Lesser General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with MFRC522-Python. If not, see . 22 | # 23 | 24 | import RPi.GPIO as GPIO 25 | import MFRC522 26 | import signal 27 | 28 | continue_reading = True 29 | 30 | # Capture SIGINT for cleanup when the script is aborted 31 | def end_read(signal,frame): 32 | global continue_reading 33 | print "Ctrl+C captured, ending read." 34 | continue_reading = False 35 | GPIO.cleanup() 36 | 37 | # Hook the SIGINT 38 | signal.signal(signal.SIGINT, end_read) 39 | 40 | # Create an object of the class MFRC522 41 | MIFAREReader = MFRC522.MFRC522() 42 | 43 | # This loop keeps checking for chips. If one is near it will get the UID and authenticate 44 | while continue_reading: 45 | 46 | # Scan for cards 47 | (status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) 48 | 49 | # If a card is found 50 | if status == MIFAREReader.MI_OK: 51 | print "Card detected" 52 | 53 | # Get the UID of the card 54 | (status,uid) = MIFAREReader.MFRC522_Anticoll() 55 | 56 | # If we have the UID, continue 57 | if status == MIFAREReader.MI_OK: 58 | 59 | # Print UID 60 | print "Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3]) 61 | 62 | # This is the default key for authentication 63 | key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF] 64 | 65 | # Select the scanned tag 66 | MIFAREReader.MFRC522_SelectTag(uid) 67 | 68 | # Dump the data 69 | MIFAREReader.MFRC522_DumpClassic1K(key, uid) 70 | 71 | # Stop 72 | MIFAREReader.MFRC522_StopCrypto1() 73 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | 167 | -------------------------------------------------------------------------------- /MFRC522.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf8 -*- 3 | # 4 | # Copyright 2014,2018 Mario Gomez 5 | # 6 | # This file is part of MFRC522-Python 7 | # MFRC522-Python is a simple Python implementation for 8 | # the MFRC522 NFC Card Reader for the Raspberry Pi. 9 | # 10 | # MFRC522-Python is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU Lesser General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # MFRC522-Python is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU Lesser General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with MFRC522-Python. If not, see . 22 | # 23 | 24 | import RPi.GPIO as GPIO 25 | import spi 26 | import signal 27 | import time 28 | 29 | class MFRC522: 30 | NRSTPD = 22 31 | 32 | MAX_LEN = 16 33 | 34 | PCD_IDLE = 0x00 35 | PCD_AUTHENT = 0x0E 36 | PCD_RECEIVE = 0x08 37 | PCD_TRANSMIT = 0x04 38 | PCD_TRANSCEIVE = 0x0C 39 | PCD_RESETPHASE = 0x0F 40 | PCD_CALCCRC = 0x03 41 | 42 | PICC_REQIDL = 0x26 43 | PICC_REQALL = 0x52 44 | PICC_ANTICOLL = 0x93 45 | PICC_SElECTTAG = 0x93 46 | PICC_AUTHENT1A = 0x60 47 | PICC_AUTHENT1B = 0x61 48 | PICC_READ = 0x30 49 | PICC_WRITE = 0xA0 50 | PICC_DECREMENT = 0xC0 51 | PICC_INCREMENT = 0xC1 52 | PICC_RESTORE = 0xC2 53 | PICC_TRANSFER = 0xB0 54 | PICC_HALT = 0x50 55 | 56 | MI_OK = 0 57 | MI_NOTAGERR = 1 58 | MI_ERR = 2 59 | 60 | Reserved00 = 0x00 61 | CommandReg = 0x01 62 | CommIEnReg = 0x02 63 | DivlEnReg = 0x03 64 | CommIrqReg = 0x04 65 | DivIrqReg = 0x05 66 | ErrorReg = 0x06 67 | Status1Reg = 0x07 68 | Status2Reg = 0x08 69 | FIFODataReg = 0x09 70 | FIFOLevelReg = 0x0A 71 | WaterLevelReg = 0x0B 72 | ControlReg = 0x0C 73 | BitFramingReg = 0x0D 74 | CollReg = 0x0E 75 | Reserved01 = 0x0F 76 | 77 | Reserved10 = 0x10 78 | ModeReg = 0x11 79 | TxModeReg = 0x12 80 | RxModeReg = 0x13 81 | TxControlReg = 0x14 82 | TxAutoReg = 0x15 83 | TxSelReg = 0x16 84 | RxSelReg = 0x17 85 | RxThresholdReg = 0x18 86 | DemodReg = 0x19 87 | Reserved11 = 0x1A 88 | Reserved12 = 0x1B 89 | MifareReg = 0x1C 90 | Reserved13 = 0x1D 91 | Reserved14 = 0x1E 92 | SerialSpeedReg = 0x1F 93 | 94 | Reserved20 = 0x20 95 | CRCResultRegM = 0x21 96 | CRCResultRegL = 0x22 97 | Reserved21 = 0x23 98 | ModWidthReg = 0x24 99 | Reserved22 = 0x25 100 | RFCfgReg = 0x26 101 | GsNReg = 0x27 102 | CWGsPReg = 0x28 103 | ModGsPReg = 0x29 104 | TModeReg = 0x2A 105 | TPrescalerReg = 0x2B 106 | TReloadRegH = 0x2C 107 | TReloadRegL = 0x2D 108 | TCounterValueRegH = 0x2E 109 | TCounterValueRegL = 0x2F 110 | 111 | Reserved30 = 0x30 112 | TestSel1Reg = 0x31 113 | TestSel2Reg = 0x32 114 | TestPinEnReg = 0x33 115 | TestPinValueReg = 0x34 116 | TestBusReg = 0x35 117 | AutoTestReg = 0x36 118 | VersionReg = 0x37 119 | AnalogTestReg = 0x38 120 | TestDAC1Reg = 0x39 121 | TestDAC2Reg = 0x3A 122 | TestADCReg = 0x3B 123 | Reserved31 = 0x3C 124 | Reserved32 = 0x3D 125 | Reserved33 = 0x3E 126 | Reserved34 = 0x3F 127 | 128 | serNum = [] 129 | 130 | def __init__(self, dev='/dev/spidev0.0', spd=1000000): 131 | spi.openSPI(device=dev,speed=spd) 132 | GPIO.setmode(GPIO.BOARD) 133 | GPIO.setup(self.NRSTPD, GPIO.OUT) 134 | GPIO.output(self.NRSTPD, 1) 135 | self.MFRC522_Init() 136 | 137 | def MFRC522_Reset(self): 138 | self.Write_MFRC522(self.CommandReg, self.PCD_RESETPHASE) 139 | 140 | def Write_MFRC522(self, addr, val): 141 | spi.transfer(((addr<<1)&0x7E,val)) 142 | 143 | def Read_MFRC522(self, addr): 144 | val = spi.transfer((((addr<<1)&0x7E) | 0x80,0)) 145 | return val[1] 146 | 147 | def SetBitMask(self, reg, mask): 148 | tmp = self.Read_MFRC522(reg) 149 | self.Write_MFRC522(reg, tmp | mask) 150 | 151 | def ClearBitMask(self, reg, mask): 152 | tmp = self.Read_MFRC522(reg); 153 | self.Write_MFRC522(reg, tmp & (~mask)) 154 | 155 | def AntennaOn(self): 156 | temp = self.Read_MFRC522(self.TxControlReg) 157 | if(~(temp & 0x03)): 158 | self.SetBitMask(self.TxControlReg, 0x03) 159 | 160 | def AntennaOff(self): 161 | self.ClearBitMask(self.TxControlReg, 0x03) 162 | 163 | def MFRC522_ToCard(self,command,sendData): 164 | backData = [] 165 | backLen = 0 166 | status = self.MI_ERR 167 | irqEn = 0x00 168 | waitIRq = 0x00 169 | lastBits = None 170 | n = 0 171 | i = 0 172 | 173 | if command == self.PCD_AUTHENT: 174 | irqEn = 0x12 175 | waitIRq = 0x10 176 | if command == self.PCD_TRANSCEIVE: 177 | irqEn = 0x77 178 | waitIRq = 0x30 179 | 180 | self.Write_MFRC522(self.CommIEnReg, irqEn|0x80) 181 | self.ClearBitMask(self.CommIrqReg, 0x80) 182 | self.SetBitMask(self.FIFOLevelReg, 0x80) 183 | 184 | self.Write_MFRC522(self.CommandReg, self.PCD_IDLE); 185 | 186 | while(i self.MAX_LEN: 222 | n = self.MAX_LEN 223 | 224 | i = 0 225 | while i 5 | # 6 | # This file is part of MFRC522-Python 7 | # MFRC522-Python is a simple Python implementation for 8 | # the MFRC522 NFC Card Reader for the Raspberry Pi. 9 | # 10 | # MFRC522-Python is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU Lesser General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # MFRC522-Python is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU Lesser General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with MFRC522-Python. If not, see . 22 | # 23 | 24 | import RPi.GPIO as GPIO 25 | import MFRC522 26 | import signal 27 | 28 | continue_reading = True 29 | 30 | # Capture SIGINT for cleanup when the script is aborted 31 | def end_read(signal,frame): 32 | global continue_reading 33 | print "Ctrl+C captured, ending read." 34 | continue_reading = False 35 | GPIO.cleanup() 36 | 37 | # Hook the SIGINT 38 | signal.signal(signal.SIGINT, end_read) 39 | 40 | # Create an object of the class MFRC522 41 | MIFAREReader = MFRC522.MFRC522() 42 | 43 | # Welcome message 44 | print "Welcome to the MFRC522 data read example" 45 | print "Press Ctrl-C to stop." 46 | 47 | # This loop keeps checking for chips. If one is near it will get the UID and authenticate 48 | while continue_reading: 49 | 50 | # Scan for cards 51 | (status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) 52 | 53 | # If a card is found 54 | if status == MIFAREReader.MI_OK: 55 | print "Card detected" 56 | 57 | # Get the UID of the card 58 | (status,uid) = MIFAREReader.MFRC522_Anticoll() 59 | 60 | # If we have the UID, continue 61 | if status == MIFAREReader.MI_OK: 62 | 63 | # Print UID 64 | print "Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3]) 65 | 66 | # This is the default key for authentication 67 | key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF] 68 | 69 | # Select the scanned tag 70 | MIFAREReader.MFRC522_SelectTag(uid) 71 | 72 | # Authenticate 73 | status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8, key, uid) 74 | 75 | # Check if authenticated 76 | if status == MIFAREReader.MI_OK: 77 | MIFAREReader.MFRC522_Read(8) 78 | MIFAREReader.MFRC522_StopCrypto1() 79 | else: 80 | print "Authentication error" 81 | 82 | -------------------------------------------------------------------------------- /Write.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf8 -*- 3 | # 4 | # Copyright 2014,2018 Mario Gomez 5 | # 6 | # This file is part of MFRC522-Python 7 | # MFRC522-Python is a simple Python implementation for 8 | # the MFRC522 NFC Card Reader for the Raspberry Pi. 9 | # 10 | # MFRC522-Python is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU Lesser General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # MFRC522-Python is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU Lesser General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with MFRC522-Python. If not, see . 22 | # 23 | 24 | import RPi.GPIO as GPIO 25 | import MFRC522 26 | import signal 27 | 28 | continue_reading = True 29 | 30 | # Capture SIGINT for cleanup when the script is aborted 31 | def end_read(signal,frame): 32 | global continue_reading 33 | print "Ctrl+C captured, ending read." 34 | continue_reading = False 35 | GPIO.cleanup() 36 | 37 | # Hook the SIGINT 38 | signal.signal(signal.SIGINT, end_read) 39 | 40 | # Create an object of the class MFRC522 41 | MIFAREReader = MFRC522.MFRC522() 42 | 43 | # This loop keeps checking for chips. If one is near it will get the UID and authenticate 44 | while continue_reading: 45 | 46 | # Scan for cards 47 | (status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) 48 | 49 | # If a card is found 50 | if status == MIFAREReader.MI_OK: 51 | print "Card detected" 52 | 53 | # Get the UID of the card 54 | (status,uid) = MIFAREReader.MFRC522_Anticoll() 55 | 56 | # If we have the UID, continue 57 | if status == MIFAREReader.MI_OK: 58 | 59 | # Print UID 60 | print "Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3]) 61 | 62 | # This is the default key for authentication 63 | key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF] 64 | 65 | # Select the scanned tag 66 | MIFAREReader.MFRC522_SelectTag(uid) 67 | 68 | # Authenticate 69 | status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8, key, uid) 70 | print "\n" 71 | 72 | # Check if authenticated 73 | if status == MIFAREReader.MI_OK: 74 | 75 | # Variable for the data to write 76 | data = [] 77 | 78 | # Fill the data with 0xFF 79 | for x in range(0,16): 80 | data.append(0xFF) 81 | 82 | print "Sector 8 looked like this:" 83 | # Read block 8 84 | MIFAREReader.MFRC522_Read(8) 85 | print "\n" 86 | 87 | print "Sector 8 will now be filled with 0xFF:" 88 | # Write the data 89 | MIFAREReader.MFRC522_Write(8, data) 90 | print "\n" 91 | 92 | print "It now looks like this:" 93 | # Check to see if it was written 94 | MIFAREReader.MFRC522_Read(8) 95 | print "\n" 96 | 97 | data = [] 98 | # Fill the data with 0x00 99 | for x in range(0,16): 100 | data.append(0x00) 101 | 102 | print "Now we fill it with 0x00:" 103 | MIFAREReader.MFRC522_Write(8, data) 104 | print "\n" 105 | 106 | print "It is now empty:" 107 | # Check to see if it was written 108 | MIFAREReader.MFRC522_Read(8) 109 | print "\n" 110 | 111 | # Stop 112 | MIFAREReader.MFRC522_StopCrypto1() 113 | 114 | # Make sure to stop reading for cards 115 | continue_reading = False 116 | else: 117 | print "Authentication error" 118 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | RPi.GPIO==0.6.3 2 | -e git+https://github.com/lthiery/SPI-Py.git#egg=spi-pi 3 | --------------------------------------------------------------------------------