title: Arduino serial data manipulation - Sensors Serial Data, Read and parse to variables
body: <p>I send 3 set of data from 3 sensors from Arduino 1 (router) to another Arduino(coordinator) to with wireless technology (xbee):
  On coordinator, I receive wireless data from this 3 sensors(from the router) perfectly. The data stream is something like this(each sensor data on its line):<br>
  <br>22.5624728451
  <br>944
  <br>8523</p>
  
  <p>I want to have these 3 values as 3 variables that get updated constantly and then pass these values on to the rest of the program to make something like print on LCD or something else:<br>
  <br>temperature=22. 5624728451 
  <br>gas=944
  <br>smoke=8523<br>
  <br>
  Initially, I had only 2 sensors and I send the data of these 2 sensors something like this: 
  <br>22.5624728451944(22.5624728451 – temperature, 944 - gas)  and I received both of them on the same line and divided everything into two variables(with readString.substring() ) with the code below. But now I have 3 sensors and I receive data on a separate line because I don't know which is the length of each data string … And I can't use the same technique (sending only one string that contain all sensor data on the same line and then divide them)</p>
  
  <p>My old code:</p>
  
  <pre><code>    #include &lt;LiquidCrystal.h&gt;
      LiquidCrystal lcd(12,11,10,9,8,7);  
      String temperature;
      String gas;
      String readString;
  
      void setup() {
      Serial.begin(9600);          
      lcd.begin(16, 2);                              
      }
      void loop() {
        while (Serial.available() &gt; 0)                             
      {
      char IncomingData = Serial.read();                   
      readString += IncomingData ;       
      temperature = readString.substring(0, 13); //get the first 13 characters
      gas = readString.substring(13, 16); //get the last 3 characters 
  
      Serial.print(IncomingData);  //here I have my string: 20.1324325452924 wichs is updating properly when I have sensor values changes 
  
      // Process message when new line character is DatePrimite
      if (IncomingData == '\n')
      {
        Serial.println(temperature);
        lcd.setCursor(0,0);                              
        lcd.write("T:");
        lcd.print(temperature);               
       delay(500);
       temperature = "";                               // Clear DatePrimite buffer
  
       Serial.println(gaz);
       lcd.begin(16, 2);
       lcd.setCursor(0,1);                              
       lcd.write("G:");
       lcd.print(gas);
       delay(500);
       gaz = "";                                       // Clear DatePrimite buffer
       readString = "";
    }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>All I want to do now is to assign a variable for every sensor data (3 lines – 3 variables for each line) updated constantly and then pass these values on to the rest of the program. Does anyone have any idea how to modify the code tO work in this situation?
  Thank you in advance!</p>