File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,25 +6,36 @@ This code was published in relation to a [blog post](https://pimylifeup.com/rasp
66
77## Installation
88
9- Until the package is on PyPi, clone this repository and run ` python setup.py install ` in the top level directory.
9+ The package is available on PyPI.
10+ ``` shell
11+ pip install mfrc522
12+ ```
13+
14+ To build from source, clone this repository and run the setup script inside the top level directory.
15+ ``` shell
16+ git clone https://github.com/pimylifeup/MFRC522-python
17+ cd MFRC522-python
18+ python setup.py install
19+ ```
1020
1121## Example Code
1222
1323The following code will read a tag from the MFRC522
1424
1525``` python
16- from time import sleep
17- import sys
26+ import time
27+
1828from mfrc522 import SimpleMFRC522
29+
30+
1931reader = SimpleMFRC522()
2032
2133try :
2234 while True :
2335 print (" Hold a tag near the reader" )
2436 id , text = reader.read()
25- print (" ID: %s \n Text: %s " % (id ,text))
26- sleep(5 )
27- except KeyboardInterrupt :
28- GPIO .cleanup()
29- raise
37+ print (f " { id = } \n { text = } " )
38+ time.sleep(5 )
39+ finally :
40+ reader.cleanup()
3041```
You can’t perform that action at this time.
0 commit comments