Sedning data through serial and interpreting them

Hi, i have a problem with sending data through serial.
Im using a send buffer on the side of Arduino Mega and recieve buffer on Wemos nodemcu v3. The problem is if i send one buffer to the other for the first time, the data is correct and every variable has its data. But after 3 loops on both devices, my data lands in literally random places in my recieve buffer array and i cant determine which data is which.

Can someone show me an example how to send data from 9 dynamic different variables on arduino, to 9 other variables that wemos nodemcu v3 can process and determine which number is which?

Thanks in advance

Maybe Robin's Serial Input Basics - updated might be of help. It gives ideas for the receiving end; next you can write the matching sending end.

If you post both your codes, we might be able to give a more tailored advise.

And how about sending a whole JSON file through serial? for me it contains about 152 characters, but is it possible to sent that large object through serial?

Of course. You just have to make sure that the receiving end isn't running blocking code or you risk overflowing the Serial input buffer.

+1 for the serial input basics. Sending packets with start and end markers will greatly aid in maintaining synchronization.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.