Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5051

Troubleshooting • Re: SIM7600 can't receive SMS

$
0
0
...
but when executing the following code,
ser.read() --I got b' '
ser.readlines() -- I got [ ]

Just don't understand why the reading returns are empty.
Basically this means you have not received anything on the serial port during the wait time defined in the port configuration:

Code:

ser = serial.Serial ('dev/ttyS0',115200, timeout=1)
The 'timeout' part of the command means wait for 1 second if nothing is received and then return to the program.

The guide (found at this page) states:
timeout = None: wait forever / until requested number of bytes are received
timeout = 0: non-blocking mode, return immediately in any case, returning zero or more, up to the requested number of bytes
timeout = x: set timeout to x seconds (float allowed) returns immediately when the requested number of bytes are available, otherwise wait until the timeout expires and return all bytes that were received until then.
The requested number of bytes is defined in the read() command and defaults to 1 character and any number of characters up to AND INCLUDING the end of line for readline()

Statistics: Posted by MiscBits — Mon Apr 22, 2024 8:07 pm



Viewing all articles
Browse latest Browse all 5051

Trending Articles