user4533: I'm trying to make project to monitor my home. I am using some gas sensors and temperature and humidity sensors. I want to do this wirelessly and I think the 
best thing to do that is XBee.
I use this code for the transmitter Arduino:
char dataPacket[64];

int gx = 1;
int gy = 321;
int gz = 456;
int ax = 654;
int ay = 789;
int az = 987; 
int mx = 147; 
int my = 258; 
int mz = 369;

void setup(){

 Serial.begin(9600);

}

void loop(){





   sprintf(dataPacket, "X%d" ,gx);
    //  sprintf(dataPacket, "A%dB%dC%dD%dE%dF%dG%dH%dI%d", gx, gy, gz, ax, ay, az, mx,     my, mz);
Serial.println(dataPacket);


    }

gx gy gz .... these are the sensor reading variables
and in the receiving Arduino I use this code
void setup(){
    // Start up our serial port, we configured our XBEE devices for 9600 bps.
    Serial.begin(9600); 
}

void loop()
{

    if(Serial.available() > 0)
{
     while(Serial.available() > 0)
 {
        char dataPacket[64];

for (int i = 0; i < 64; i++)
{
  dataPacket[i] = Serial.read();
 Serial.print(dataPacket[0]);

}

String show = Serial.readStringUntil('C') ;
delay(500);

}
}
}

but i can't split the values from the stream and put them into their variables (gx gy ...)
Does anyone have idea how to split it?

user1566: Try a communication protocol with a , as a delimiter like:
messageId,data1,data2,data3,....,dataN\n

And use the Messenger library to parse it.
See my answer on comms protocols here:
Communication Protocol Best Practices and Patterns
An how to use the Messenger library here:
Send Processing color data into Arduino

4533: <p>I'm trying to make project to monitor my home. I am using some gas sensors and temperature and humidity sensors. I want to do this wirelessly and I think the 
best thing to do that is XBee.</p>

<p>I use this code for the transmitter Arduino:</p>

<pre><code>char dataPacket[64];

int gx = 1;
int gy = 321;
int gz = 456;
int ax = 654;
int ay = 789;
int az = 987; 
int mx = 147; 
int my = 258; 
int mz = 369;

void setup(){

 Serial.begin(9600);

}

void loop(){





   sprintf(dataPacket, "X%d" ,gx);
    //  sprintf(dataPacket, "A%dB%dC%dD%dE%dF%dG%dH%dI%d", gx, gy, gz, ax, ay, az, mx,     my, mz);
Serial.println(dataPacket);


    }
</code></pre>

<p>gx gy gz .... these are the sensor reading variables</p>

<p>and in the receiving Arduino I use this code</p>

<pre><code>void setup(){
    // Start up our serial port, we configured our XBEE devices for 9600 bps.
    Serial.begin(9600); 
}

void loop()
{

    if(Serial.available() &gt; 0)
{
     while(Serial.available() &gt; 0)
 {
        char dataPacket[64];

for (int i = 0; i &lt; 64; i++)
{
  dataPacket[i] = Serial.read();
 Serial.print(dataPacket[0]);

}

String show = Serial.readStringUntil('C') ;
delay(500);

}
}
}
</code></pre>

<p>but i can't split the values from the stream and put them into their variables (gx gy ...)</p>

<p>Does anyone have idea how to split it?</p>
 1566: <p>Try a communication protocol with a <code>,</code> as a delimiter like:</p>

<pre><code>messageId,data1,data2,data3,....,dataN\n
</code></pre>

<p>And use the <code>Messenger</code> library to parse it.</p>

<p>See my answer on comms protocols here:</p>

<p><a href="https://arduino.stackexchange.com/questions/4214/communication-protocol-best-practices-and-patterns/4222#4222">Communication Protocol Best Practices and Patterns</a></p>

<p>An how to use the <code>Messenger</code> library here:</p>

<p><a href="https://arduino.stackexchange.com/questions/4436/send-processing-color-data-into-arduino/4527#4527">Send Processing color data into Arduino</a></p>
