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())
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())