how to refresh lcd properly

Hi,
i got a 20x4 lcd i2c and the following problem:

i have a sensor value first in the lcd and a counter next to that.

after some counts i got something like this in the display:

0.00__3

once the sensor value reaches 10 it becomes this:

10.00__3
but once the sensors value flips back to 0 it looks like this:
0.00__33
the lcd doesnt erase the 3/refresh the space _ once it goes back.

Could you tell me how to do that?

and can i make it somehow look like always _0.00 instead of 0.00 and moving all chars one space to the right after it reaches 10?

I guess you are trying to make a Data Logger. I had a similar problem. Here is what i did.

Fix the position of the value and the counter on the LCD before you print the data to the LCD. In your case it will be
lcd.setCursor(col,rows);

lcd.clear();
lcd.setCursor(0,0);
lcd.print(val);
lcd.setCursor(5,0);
lcd.print(counter);

and can i make it somehow look like always _0.00 instead of 0.00 and moving all chars one space to the right after it reaches 10?

for this i added a trailing zero in case the value is less then 10. Use if-else statement

lcd.print("0"); \ if value less then 10
lcd.print(""); \ if value is more then 10

I am a beginner myself so i am sure this is a really crude method and lot of people will suggest more efficient coding but well , we all are learning ..aint we...

and lot of people will suggest more efficient coding

They already have ... many times. Finding those posts is another matter.

Try this one: Arduino Forum

Don

thx a lot,
this is great:

well actually im always searching first, but sometimes its not that easy for me to find the right thing, when you get like 400 search results.