Responding to serial echo

Hello,

I want my sketch only to be able to continue if I´ve got the echo of my last sent serial output.
This means that I send a character and wait till the response is detected. Then it should be possible to send the next, but not before.

Has someone an idea how to implement this? Is this possible with the Serial.event function?

Thanks

Simply send the serial and then go into a while loop looking for the byte to return when it does come out of the loop.

How can I look for my char if it has come in? My problem is, that I`m sending different chars and I have to wait for exactly the last char I´ve sent.
For example I´m sending the following data:

Serial1.print("S");
  void echo;
  Serial1.print("Y");
  void echo;
  Serial1.print("*");
  void echo;
  Serial1.print('\r');
  void echo_return();

Now its possible to define a void echo for every char to wait for the incoming like this

void echo_return()
{
  while(SMT5echo == '\r')
  {
    break;
  }
}

Then the code would stop until the Arduino receives the \r
But I need something like this

void echo()
{
  while(SMT5echo == Serial1.print("last char"))
  {
    break;
  }
}

where the last sent char can vary and the code still stops until the Arduino received the last sent character.
This means I need a function for different values.
How could I implement this?

Sorry I have absoloutly no idea of what you are asking or what you are trying to do. One thing I do know however is that what ever it is you are going about it in totally the wrong way.
So step back and say what your over aime is not what you think a soloution to what you thnk is a problem.

I want my code to go on if the echo of my transmitted data arrives. My problem is, that my sent data is always another char, so I need a loop which can be used as standard, independent from the character which is sent

Have you read the how to use this forum sticky? It is at the start of every section.
There it will tell you how to ask for help.

What on earth is the SMT5echo that appears in the code you posted? It can't be a function because there are no brackets.
If you want to read the serial port until a specific character has been read the you can use this function:-

void echo_return(char c)
{
  while(Serial.read() != c) { } // do nothing until we receive c
}

I´m sorry if I´ve asked the wrong way for help.
My goal is to read the serial port until the last sent character has been read, like this

Like what?

Why is what you want to do not what I posted last?

After each sending of a char I want to wait until this char is echoed. I need a routine like this

void echo_return()
{
  while(Serial.read() != "The last sent char")
           { 
                  // do nothing until we receive the last sent char
           } 
}

Its always the last character,I sent. It should be an universal routine, not one for each character.

Serial code that does not send back the previously sent characters until a comma , is received.

//zoomkat 3-5-12 simple delimited ',' string  
//from serial port input (via serial monitor)
//and print result out serial port

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,
  
  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      //do stuff
      Serial.println(readString); //prints string to serial port out
      readString=""; //clears variable for new input      
     }  
    else {     
      readString += c; //makes the string readString
    }
  }
}

It is a universal routine you pass a parameter to it, that paramater is the character you are looking for this time like you showed in that first bit of code only instead of just calling a routine with no paramaters you cal, the one I posted with the character that you are looking for.
There is no way to automatically fish out the last character you sent over the serials port.

Thanks for help, I got the idea.