Python Script for Interfacing RFID Reader with Raspberry Pi.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import serial | |
data = serial.Serial( | |
port='/dev/ttyS0', | |
baudrate = 9600, | |
parity=serial.PARITY_NONE, | |
stopbits=serial.STOPBITS_ONE, | |
bytesize=serial.EIGHTBITS | |
) | |
#timeout=1 # must use when using data.readline() | |
#) | |
print " " | |
try: | |
while 1: | |
#x=data.readline()#print the whole data at once | |
#x=data.read()#print single data at once | |
print "Place the card" | |
x=data.read(12)#print upto 10 data at once and the | |
#remaining on the second line | |
if x=="13004A29E191": | |
print "Card No - ",x | |
print "Welcome Bala" | |
print " " | |
elif x=="13006F8C7282": | |
print "Card No - ",x | |
print "Welcome Teja" | |
print " " | |
else: | |
print "Wrong Card....." | |
print " " | |
#print x | |
except KeyboardInterrupt: | |
data.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment