Browse Source

premier commit

prismx 3 months ago
commit
0fb5321a8d
2 changed files with 27 additions and 0 deletions
  1. 0 0
      README.md
  2. 27 0
      Script.py

+ 0 - 0
README.md


+ 27 - 0
Script.py

@@ -0,0 +1,27 @@
1
+!/usr/bin/env python 
2
+import RPi.GPIO as GPIO 
3
+from mfrc522 import SimpleMFRC522 
4
+
5
+reader = SimpleMFRC522() 
6
+
7
+try: 
8
+	id, text = reader.read()
9
+	print(id) 
10
+	print(text) 
11
+	print(type(id))	
12
+	id_str = str(id)
13
+	chemin =  '/home/prismx/rc522/fichier.txt'
14
+	f = open(chemin, 'r')
15
+	texte = f.readlines()
16
+	if  (id_str+'\n') in texte:
17
+		print(id)
18
+	
19
+	
20
+finally:
21
+
22
+	
23
+
24
+ 
25
+	
26
+	GPIO.cleanup()
27
+