biomakespace / OpenPlantToy

Arduino & Python controller code for the open plant toy
0 stars 0 forks source link

STOP Character(s) Instead of Delay Period #2

Open snasphysicist opened 5 years ago

snasphysicist commented 5 years ago

Currently the component code uses a "latency" delay to try to ensure that it does not miss parts of message, i.e. before checking whether another byte is available at the serial port, the code waits a specified amount of time (documented here). It assumes that, if no byte was transferred during that time period, the complete message has been received.

There is a possibility that parts of the message could get lost, if it takes longer to send the byte that this latency period.

Is this actually possible in serial communications? Or is the information guaranteed to take place according to the baud rate?

If this is possible, could we improve the situation by using a STOP character to identify the end of a message?