串行端口返回我在写功能中给出的值(回声效果)
我只是试图通过串行端口在开发板和我的Ubuntu系统之间进行通信。
我使用的是带有Python3.9的Pyserial软件包。
if __name__ == '__main__':
ser = None
try:
ser = serial.Serial('/dev/ttyUSB2', 115200, timeout=5)
print('Successfully connected!')
except ConnectionError as msg:
print(msg)
cmd = b"AT\r\n"
#cmd = "AT"
#ser.write(cmd.encode)
#ser.write(cmd.encode('utf-8')
ser.write(cmd)
resp = ser.readline()
print(resp)
ser.close()
我已经尝试发送该命令“ ate0”以关闭回声,但它行不通。
请,如果您对此有任何想法,我将感谢您的帮助。
I'm just trying to setup a communication between a development board and my Ubuntu system through the serial port.
I'm using the pyserial package with python3.9.
if __name__ == '__main__':
ser = None
try:
ser = serial.Serial('/dev/ttyUSB2', 115200, timeout=5)
print('Successfully connected!')
except ConnectionError as msg:
print(msg)
cmd = b"AT\r\n"
#cmd = "AT"
#ser.write(cmd.encode)
#ser.write(cmd.encode('utf-8')
ser.write(cmd)
resp = ser.readline()
print(resp)
ser.close()
I've already tried to send that command 'ATE0' to turn off the ECHO, but it doesn't work.
Please, if you have any idea about this, I would appreciate the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论