arduino中的数据保存在micro SD中,我需要通过串行方式传递到sqlite数据库,我正在创建一个界面,在其中按下按钮并将数据库转发到数据库,这将是意图,但我对此有困难,有人可以提供帮助吗?
Python
return redirect('projectView', project_id=1)
Arduino
def arduino(self):
lines=b''
with serial.Serial('COM5',9600,timeout=2) as ser:
line = ser.readline()
line = line.decode("utf-8")
lines += bytes(line, 'utf-8')
line = line.split()
banco = sqlite3.connect('banco.db')
cursor = banco.cursor()
sql = """INSERT INTO users (user,senha) VALUES ('{line[0]}','{line[1]}')"""
cursor.execute(sql)
banco.commit()