Arduino Serial Question

Hello,

I was wondering if anyone could tell me how to send a string to the arduino and just echo it back to the serial monitor but also create a NEW LINE.  Right now I got it to take a string and echo it back exactly but every time I send the string form the computer to the ard it just tacks the echo from the ard right back onto the end of the previous data that is showing in the monitor.  

 

For example: 

I get this:

hello from arduino!!hello from arduino!!

 

I want this:

hello from arduino!!

hello from arduino!!

 

Can anybody lead me in the right direction?

One

One solution:

Serial.println("");

Will do a carriage return.

I tried that but all it does

I tried that but all it does is make the string in the monitor look like this.

Example:

h

e

l

l

o

 

 

Here is the code:

void loop()

{

int data;

   //while(Serial.available() == 0);

  if(Serial.available() != 0)

{

data = Serial.read();

Serial.print((char)data);

}

Serial.println("");

}

What are you trying to

What are you trying to accomplish?  Echoing every character?  Try using an if/else statement that sends the  Serial.println(""); statement when it detects the enter key, or echos the typed character if it doesn’t.

sorry for posting it

sorry for posting it incorrectly.  I forgot to hit the reply link first.

I am trying to send a string

I am trying to send a string to the arduino and then the arduino just simply echos the same thing back to the monitor.  everytime time i send a string, the string that the arduino sends back will be on a new line.