python 访问串口

1. 安装PySerial module:

pip install pyserial

2. ser = serial.Serial(DEVICE, BAUD)

具体的:

ser = serial.Serial("COM1",9600)

写入串口:

ser.write("some text")

读取串口:

while True:

print(ser.read())

猜你喜欢

转载自blog.csdn.net/madrabbit1987/article/details/78992682