arduino_app inventor and bluetoooth.


I’m currrently building a robot, controled by a arduino board (Mega adk) and i’m trying to control it via bluetooth, using a HC-06 and app inventor.

First, I use to just control if the motor is running or not, wich is pretty easy, by sending a number to my arduino.

Now, i would like to evolve and controle the speed with the accelerometer. In order to do so, I need to send more information at the same time, and the problem begin.

So on my serial port, i got a lot of information, arriving bytes after bytes. how can I separate the different acceleration?

for nom, i made a buffer wich is full of the information.
for example here is what i got:

with the code:

char buffer[15];
int ref;
char p;
void setup()

void loop() {
  if(Serial1.available() > 0) {
  Serial1.readBytesUntil(ref  ,buffer, 15);
  for (int i=0; i <= 14; i++){
  Serial.println(" ");

how can I put the right information in the right case? (here X=-10, Y= 8 and Z= 1013, then X=-11, Y=7 and Z = 1014 …)

thank you very much,