I am using a Arduino Mega to collect readings from a pressure sensor and send to a phone, for a certain period every day. The Arduino takes readings 1000 readings over 10 seconds and sends them to the phone via mySerial.print(sensor read) function. The problem is that sometimes a pressure reading will get divided across 2 packets.
Is there a way to define the start and end of a packet to be sent? I have done a lot of research and it doesn't seem to be a discussed topic. Essentially we have a packet flag of "83"(In ASCII) and we will get packets like the below:
38 33 34 35 36
38 33 34 36 35
38 33 34 37 35 38
33 34 36
Packet 3 contains some data that should be contained in our 4th value. And we are worried that we will lose data with the packets in this manner.
Is there a way to say that the packet only contains open flag and 1 pressure reading?