PaulStoffregen
Well-known member
It works but from time to time stops receiving from serial until I press again....
Perhaps your serial code is somehow getting out of sync with the data?
From only a quick glance at the code, it seems to just grab 6 bytes and use them without any checking whether they really are the intended bytes. If it ever gets out of sync, you'd have a 1 in 6 chance of grabbing the intended bytes. Otherwise, you might grab the pixel colors and mistakenly use them as the X & Y coordinates.
Normally this sort of communication uses a unique or unlikely byte or sequence of bytes as a header. If the received data doesn't have a proper header, usually some sort of re-sync is done, like discarding bytes until the header is seen.