first commit

This commit is contained in:
filip 2022-01-12 21:21:24 +00:00
commit 4002af4998
2 changed files with 21 additions and 0 deletions

20
registrer.py Normal file
View File

@ -0,0 +1,20 @@
from mfrc522 import SimpleMFRC522#rfid reader library
from requests import post#make post requests
from RPi import GPIO
import json
with open('./settings.json') as json_settings:#open json file with settings
settings = json.loads(json_settings.read())#read the json to a python object
reader = SimpleMFRC522()
try:
while True:
id, text = reader.read()#read rfid
print(id)
print(text)
post(settings['url'], {'rfid': str(id) + str(text)})#send POST with rfid
#add code to keep a local backup database
except KeyboardInterrupt:#ctrl + c
GPIO.cleanup()#clean up the gpio
raise#exit program

1
settings.json Normal file
View File

@ -0,0 +1 @@
{"url": "http://filip-e490.home/stafett/registrer_stafettpinne.php"}