[Tutor] Serial communication problem

Phil phillor9 at gmail.com
Tue Dec 12 16:20:20 EST 2023


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. I also got rid of the class 
structure which made the code far simpler. There was also a logic error 
in the python code and the length of that code has been greatly reduced 
as well.

Thank you for your interest in my problems and your time is not wasted. 
I often pick up useful tips from the answers to other's questions.

By the way, the object of this exercise was to gain experience in 
reading and writing to the pico via USB and then to build a dashboard to 
monitor a cyclone that has since crossed the coast a little north of my 
current location.  The dashboard also works correctly and the cyclone 
has veered away from it's initial predicted course.

-- 
Regards,
Phil


More information about the Tutor mailing list