Issue
I need to read response from an AT command sent using pyserial . I am able to Read the responses of all other commands I send but for only ping command I cannot read the response ,though I can see the response if I try with a tool like teraterm for the same command How can I fix this
Sr = serial.Serial(comport,baudrate,timeout=2)
Sr.write(b'AT+Ping=-6google.com)
Response = Sr.read(Sr.inwaitin())
Solution
You can just wait for few seconds before reading as the ping response might take some time
Sr = serial.Serial(comport,baudrate,timeout=2)
Sr.write(b'AT+Ping=-6google.com)
time.sleep(4)
Response = Sr.read(Sr.inwaitin())
Answered By - Newbie_2021
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.