Need help with getting arduino to identify a value sent over the serial port


I am connecting two arduino's together and one will be connected to a 5 inch display, the second will be connected to a bunch of sensors (temperature, water, distance etc). For my reef aquarium.
Using the serial tx and rx ports.
What I need a bit of help with is just a point in the right direction of what code I could use to do this.

I.E. If I had temperature and water sensors, and they were sending their values over the tx port to the other arduino, how would I code to know what value is what.

I thought I could possibly do it something like this, but got stuck half way:

  1. Temp 1 Sensor value read, value obtained
  2. Send the word "Temp1" over serial to display arduino, then send the temp1 value over serial
  3. The lcd display arduino has an if statement, looking for the string "Temp1".
  4. If so - read only the next value (which should be the value for temp1) and save as integer
  5. Display the integer on lcd.

This could be a really messy way to do this (I don't know, hence why I'm asking for help).

It you guys think it will work, can you please help me out with example code for step 4?
That's the only bit I'm having trouble with, I don't know how to get it to stop reading only after it has got the first value sent over serial after the 'Temp1' has been sent.

The below test code is for servo control, but it might be of use for ideas. The servo command values are followed by a servo identifier and a comma , data packet delimiter.

//zoomkat 11-22-12 simple delimited ',' string parse 
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added 

String readString;
#include <Servo.h> 
Servo myservoa, myservob, myservoc, myservod;  // create servo object to control a servo 

void setup() {

  //myservoa.writeMicroseconds(1500); //set initial servo position if desired

  myservoa.attach(6);  //the pin for the servoa control
  myservob.attach(7);  //the pin for the servob control
  myservoc.attach(8);  //the pin for the servoc control
  myservod.attach(9);  //the pin for the servod control 
  Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded

void loop() {

  //expect single strings like 700a, or 1500c, or 2000d,
  //or like 30c, or 90a, or 180d,
  //or combined like 30c,180b,70a,120d,

  if (Serial.available())  {
    char c =;  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.println(readString); //prints string to serial port out

        int n = readString.toInt();  //convert readString into a number

        // auto select appropriate value, copied from someone elses code.
        if(n >= 500)
          Serial.print("writing Microseconds: ");
          if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
          if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
          if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
          if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
          Serial.print("writing Angle: ");
          if(readString.indexOf('a') >0) myservoa.write(n);
          if(readString.indexOf('b') >0) myservob.write(n);
          if(readString.indexOf('c') >0) myservoc.write(n);
          if(readString.indexOf('d') >0) myservod.write(n);
         readString=""; //clears variable for new input
    else {     
      readString += c; //makes the string readString