Re: Serial communication problem
Cameron Simpson <[email protected]>
| Newsgroups | gmane.comp.python.tutor |
|---|---|
| Message-ID | <[email protected]> |
On 07Dec2023 14:07, Phil <[email protected]> wrote: >Next, this code sends an "s" asking for the LED's status. This where >the problem is. The pico does not receive the "s", yet the "1" and "0" >are received using the same read method. I would be inclined to verify this for real. Write a small function: def sread(ser): data = ser.read() print("read", repr(data), "from", ser) return data and call `sread(ser_read)` wherever you're calling `ser_read.read()`. The objective here is to see all the data received, regardless of where your `read()` is taking place. (If `SerialReader` is your own class, it would be even better to stil the above `print()` in its `read()` method instead.) I don't, for example, see anything in your code about receiving the `0` or `1` status result yet you say they're received. So print out everything received, to be sure. Cheers, Cameron Simpson <[email protected]> _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor