python操作串口

import serial
test = serial.Serial("COM1",115200)#这里就已经打开了串口
print(test.portstr)
test.write('hello world'.encode("utf-8")
test.close()
posted @ 2018-11-13 23:32  朱小勇  阅读(870)  评论(0)    收藏  举报