D
D
duoman2018-02-12 18:21:13
Python
duoman, 2018-02-12 18:21:13

Python work with serial port?

Good afternoon! I send commands through the serial port (send SMS).
At what point the SMS is sent (I read the readline() answers)
After that, there are two possible options (I continue to listen to readline()):
1 The response SMS comes, the program understands that OK and exits.
2 The modem does not receive a response SMS, readline (hangs) the program freezes.
I tried to separate the communication with the script into a separate file and run it through subprocess:
We start the process, wait for the command to send SMS and then wait for the response SMS or kill the process by timeout.
Accordingly, the problem with stdout.readline () is also ..
Tell me how this task is solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Astrohas, 2018-02-12
@Astrohas

do an infinite loop something like this https://stackoverflow.com/a/13018267/7831712

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question