We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So here's what I'm working on. My Arduino board is getting readings from A0 (an analog read). It then converts this to binary and sends it through the serial port into processing. While this is happening, my Processing code is also sending values through the serial port into the Arduino board. I plan to use "tag"* codes to remove confusion in which lines Arduino or Processing will read.
Since Processing and Arduino run their codes independently, I fear that the lines will overlap in the serial port.
For example, let's say my Arduino is sending this into the serial port: 0xFF 100 150 200.
and Processing sends this to the serial port: 0xFE 5 6 7 8 9 10 11.
Is it possible that the values get mixed up (which I do not want), for example:
0xFF 100 150 0xFE 5 6 200 7 8 9 10 11
ideally, they wont get mixed up, and end up something like: 0xFF 100 150 200 0xFE 5 6 7 8 9 10 11
but I'm not sure if that will happen. Any ideas? And how to fix it?
*by "tag" codes, I mean, I'll put that if the port reads "0xFF", either Processing or Arduino will read the value in the next line as the value I intend it to read.