[Tutor] Serial communication problem

Cameron Simpson cs at cskk.id.au
Tue Dec 12 22:58:54 EST 2023


On 13Dec2023 07:20, Phil <phillor9 at gmail.com> wrote:
>On 13/12/23 04:46, Alan Gauld via Tutor wrote:
>Thank you again Alan,
>>I also don't much like the fact that you do two reads inside
>>the while True loop.
>
>This was the cause of the problem. The read function is non blocking 
>which explains why I could only read the first byte before things went 
>awry. The cure was to make the second read blocking and I felt like a 
>real dill for not realising that sooner.

Is there any reason for any of the reads to be nonblocking? Personally I 
find blocking reads easier to reason about.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Tutor mailing list