import serial
serial_com1 = serial.Serial("/dev/ttyO2", 9600, timout=5)
serial_com1.write("test_chr".encode())
msg = serial_com1.read(64) print(msg.decode())
python serial 模块使用
原文:https://www.cnblogs.com/chenfulin5/p/10025895.html