Hi guys,
Can anyone help me to fix my code so I don't get the unexpected unindent error?
The code is very big, so I'll only post a small part so you can help me.
I'm using the PyScripter IDE.
def pegar_dados_serial():
ser = serial.Serial(port='COM4', baudrate=115200, timeout=2)
#Rotina para leitura dos dados no receptor
while True:
try:
for i in ser.read():
lista.append(ord(i))
if k == 17:
k = 0
ValoresLidos['RSSI'] = lista[4]
ValoresLidos['TAG_ID'] = lista[9]
lista = []
print ValoresLidos
#Rotina para conexão com o DB e inserção dos dados na tabela
db = MySQLdb.connect(host="localhost",port=3306,user="root", passwd="xxxxxx",db="mydb")
c = db.cursor()
c.execute("""
INSERT INTO RFID (TAG_ID, RSSI)
VALUES
(lista[9], lista[4])
""")
print "Linhas inseridas: %d" % c.rowcount
k+=1
Thanks in advance.