Jun-24-2020, 02:54 AM
Hi,
I need help in saving Arduino data in phpmyadmin mysql server in raspberry pi. I connected the Arduino to raspberry pi 3B+ via usb i wrote a code and got this error.
Python code:
I need help in saving Arduino data in phpmyadmin mysql server in raspberry pi. I connected the Arduino to raspberry pi 3B+ via usb i wrote a code and got this error.
Python code:
import serial import time import MySQLdb as mdb arduino = serial.Serial("/dev/ttyACM0") arduino.boudrate = 9600 data = arduino.readline() time.sleep(2) data = arduino.readline() pieces = data.split("\t") temp = pieces[0] hum = pieces[1] con=mdb.connect('localhost','root','12345678','testdb'); with con: cursor=con.cursor() cursor.execute("INSERT INTO TempDB (temp,hum) VALUES (?, ?)") con.commit() cursor.close()Error message:
Error:Traceback (most recent call last):
File "./name.py", line 3, in <module>
import MySQLdb as mdb
ModuleNotFoundError: No module named 'MySQLdb'