Transmitting ADXL335 data every 50 ms using HC-12

Hello, I have been working on a project where I need to transmit adxl335 (e.g 345X354Y430Z) values every 50 ms from arduino nano to an arduino mega, which will send the data thru bluetooth to android for further signal processing. However, I am having a hard time getting the full length of data string which is very critical for the processing. I don't know what's making it cut the data I have already put some delay in the receiving end for some reading of the transmitted data. I think what's causing this is perhaps the current consumption of the HC-12 module.Do you have any suggestions? Btw the supply of the nano is from a PC. Attached below is my code for the transmitter and the base station. Thanks!

base-station.ino (3.66 KB)

transmitter.hc12.ino (2.29 KB)

    if(HC12Buffer[i] == 'X')
    {      x_ready = true;    }
    if(HC12Buffer[i] == 'Y')
    {      y_ready = true;    }

Under what circumstances does it make sense to have x_ready and y_ready both true?

If there are no such circumstances, then when you set y_ready to true, you should set x_ready to false.

There are NO reasons for using Strings on the base station.

  gFile.flush();
  gFile.close();

close() calls flush().

You really need to look for Robin2's tutorial called Serial Input Basics - Updated. It shows how to send and receive packets - not just streams of text. Using start and end markers, and delimiters, makes parsing much simpler. And, you'll note that Robin2 does NOT use any Strings. Nor does his code block.