如何用python写个串口通信的程序
1个回答
展开全部
使用pyserial库,是最简单的!!!
import serial
ser = serial.Serial() # open 'COM1', baudrate=9600, etc
ser.write('string out')
ser.read(1) # read 1 byte from COM port
# ...
ser.close()<img id="selectsearch-icon" src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/iknow/qb/select-search.png" alt="搜索">
import serial
ser = serial.Serial() # open 'COM1', baudrate=9600, etc
ser.write('string out')
ser.read(1) # read 1 byte from COM port
# ...
ser.close()<img id="selectsearch-icon" src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/iknow/qb/select-search.png" alt="搜索">
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询