hc05 serial communication need help

I was sending a text from my android apps to hc05 and the result is displayed on lcd. My question is how do I get the new text replace the old text displayed on the lcd. Currently when I sent "abcd" for the first time and send "efgh" a moment later, it displayed "abcdefgh". I only want "efgh" so how do I can get 'rid' of previous text. Sorry, I'm not really good at serial comm. The code:

while (Serial.available()) { char c = Serial.read(); newText += c; }

if(newText.length()>0){ lcd.setCursor(0,1); lcd.print(newText); }

So what happened on the third attempt? Try

newText="";

after the lcd.print

Nick_Pyner: So what happened on the third attempt? Try

newText="";

after the lcd.print

it display the new text but just for a while. What I want is the text will be displayed as long as there is no new text come in at the serial port.

While your code is incomplete, I assume you have the complete loop, and it looks pretty kosher. I suspect the problem might be at the other end - about which you don't say much.

You just might find the following background notes useful

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

But you already know most of it!

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

...R