-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Hi Romilly,
Thanks for your Sender - and Talker code.
It is a very elegant and versatile technique for communicating between python3 and the Pico.
However, something is not quite right, and I can't seem to figure it:
Using your original Sender code, I was getting a False after the second send:
`>>> s.send('on()')
True'
'>>> s.send('off()')
False`
When I received the False, I could fix it by issuing a s.receive() which (after a little delay - timeout?) printed out :'>>>'.
It seems that the prompt '>>>' is sitting in the buffer and needs to be cleared.
Then I looked at your more recent Talker code and you seem to have replaced Timeout=1 with Timeout=-1.
If I do a t=Talker(), I get an error with Timeout=-1:
t=Talker()
Traceback (most recent call last):
File "", line 1, in
File "/Volumes/GoogleDrive/My Drive/Python3/Pico/talker.py", line 17, in init
self.serial = serial.Serial(serialPort, 115200, timeout=timeout)
File "/Users/mike/miniforge3/lib/python3.9/site-packages/serial/serialutil.py", line 227, in init
self.timeout = timeout
File "/Users/mike/miniforge3/lib/python3.9/site-packages/serial/serialutil.py", line 369, in timeout
raise ValueError("Not a valid timeout: {!r}".format(timeout))
ValueError: Not a valid timeout: -1
Any suggestions?
Maybe the OSX 11.2.2 python serial module is behaving differently from your linux(?) version?
Mike