打印AT命令的输出 [英] Print output of AT command

查看:91
本文介绍了打印AT命令的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python与ttyUSB端口中连接的GSM调制解调器通信.

I am using python to communicate with GSM modem connected in my ttyUSB port.

import serial
from curses import ascii

ser=serial.Serial('/dev/ttyUSB0', 9600, timeout=3)
command = ser.write('AT+CMGR=3\r\n')
print command

现在要与我的调制解调器通信,我从python传递了AT命令,我需要打印完整命令字符串的输出.我该怎么办?

Now to communicate with my modem, I pass AT commands from python, I need to print the output of the complete command string. How do I do it?

推荐答案

如果您的意思是如何从调制解调器获取输出,请使用serreadreadlinereadlines方法.请参见教程.

If you mean how to get output from the modem, use read, readline or readlines methods of ser. See tutorial.

这篇关于打印AT命令的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆