Skip to content

Commit e43de79

Browse files
committed
update README
1 parent b4c4734 commit e43de79

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff 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

1323
The following code will read a tag from the MFRC522
1424

1525
```python
16-
from time import sleep
17-
import sys
26+
import time
27+
1828
from mfrc522 import SimpleMFRC522
29+
30+
1931
reader = SimpleMFRC522()
2032

2133
try:
2234
while True:
2335
print("Hold a tag near the reader")
2436
id, text = reader.read()
25-
print("ID: %s\nText: %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
```

0 commit comments

Comments
 (0)