Below, is how I can assign the uids w/in the python script
(user 1 = [xxx])
Code: Select all
import MFRC522
import signal
import datetime
import time
import os
import sys
import RPi.GPIO as GPIO
import MySQLdb
from time import sleep
from Adafruit_CharLCD import Adafruit_CharLCD
continue_reading = True
MIFAREReader = MFRC522.MFRC522()
#UIDs
user1 = [99,12,123,89,96]
#Initiate LCD
lcd = Adafruit_CharLCD(rs=26, en=19, d4=13, d5=6, d6=5, d7=21, cols=16, lines=2)
lcd.clear()
def end_read(signal, frame):
global continue_reading
continue_reading = False
print "Ctrl+C captured, ending read."
MIFAREReader.GPIO_CLEEN()
signal.signal(signal.SIGINT, end_read)
while continue_reading:
(status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)
(status,backData) = MIFAREReader.MFRC522_Anticoll()
if backData == user1:
print "IT WORKED"
Code: Select all
# DB INFO
db = MySQLdb.connect("SQLserver", "username", "password", "database")
curs=db.cursor()Code: Select all
if backData == UID from database
#Do Something