i got this 2 python script
import serial
serial = serial.Serial("/dev/ttyUSB0", baudrate=9600)
code = ''
while True:
data = serial.read()
if data == '\r':
print(code)
code = ''
else:
code = code + data
and
import time
import datetime
import MySQLdb
localtime = time.localtime(time.time())
day = localtime.tm_wday
time = localtime.tm_hour
print day
print time
data = 'DOSEN1'
db = MySQLdb.connect("localhost", "root", "", "skripsi")
cur = db.cursor()
cond1 = "SELECT nama_dosen FROM dosen WHERE kode_dosen = '%s'" %data
cur.execute(cond1)
hitung = cur.rowcount
res1 = cur.fetchall()
for row in res1:
nama_dosen = row[0]
if hitung == 1:
res1 = nama_dosen
elif hitung != 1:
print "Dosen tidak Terdaftar"
how can i join this 2 script so that the data = 'DOSEN1' can be replaced with the RFID tag number?
i really new to this programming languange, really need help. thanks
Assuming that
print(code)
gives you the value fordata
in the second script, something like this should work: