Skip to content Skip to sidebar Skip to footer

Print Output Of AT Command

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 = s

Solution 1:

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


Solution 2:

First, an AT command should be terminated with only \r and not \r\n (unless you have changed S3, and you should not do that), see V.250 for more details on that and AT commands in general (e.g. if you have not already read that specification it is highly recommended).

Then, for reading from the serial port, this is already covered in Janne Karila's answer.

Thirdly, in order to handle AT commands you must read and parse the responses you get from the modem, see this answer for description of how this should be done.


Post a Comment for "Print Output Of AT Command"