python3利用pyserial读取arduino串口数据
先安装pyserial
http://pyserial.sourceforge.net/
http://pyserial.sourceforge.net/
import time
import serial
ser = serial.Serial( #下面这些参数根据情况修改
port='COM3',
baudrate=9600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)
data = ''
while True:
data = ser.readline()
print(data)
1 个回复
ncnynl
赞同来自:
http://pyserial.sourceforge.net/