Excuse me, but python stops at the fist horror and danjpeperron corrcted the first error you made.
from https://pyserial.readthedocs.io/en/late ... l_api.html
serial py can read UP to size (less or equal the number requested)
edited or increase timeout at line .open.ing ...
Other issue
I do not understand[/code]
xor is built in by ^ (like in C end Fortran90 ) It is either complicated (edited likely comment puzlles reader; ) or wrongBTW: you can embed error messages in Code button : that makes cutting and pasting to a console or to stackoverflow easier!!!
from https://pyserial.readthedocs.io/en/late ... l_api.html
serial py can read UP to size (less or equal the number requested)
If you receive less than size, you cannot index your array with high indexes. You should at least test the length of the receided string
read(size=1)
Parameters:size – Number of bytes to read.
Returns:Bytes read from the port.
Return type:bytes
Read size bytes from the serial port. If a timeout is set it may return fewer characters than requested. With no timeout it will block until the requested number of bytes is read.
Changed in version 2.5: Returns an instance of bytes when available (Python 2.6 and newer) and str otherwise.
edited or increase timeout at line .open.ing ...
Other issue
I do not understand
Code:
#Invert number with xor crc=~crc&0xFF crc+=1
xor is built in by ^ (like in C end Fortran90 ) It is either complicated (edited likely comment puzlles reader; ) or wrong
Code:
>>> 55 ^0xFF200>>>
Statistics: Posted by dbrion1 — Thu Jan 11, 2024 3:41 pm