import serial
ser = serial.Serial("/dev/ttyACM0", baudrate = 9600, timeout=1)
while 1:
Data = ser.readline().decode('ascii')
print(Data)
Error: AttributeError: 'module' object has no attribute 'Serial'
You're importing the module, not the class. So, you have to use:
from serial import serial
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.