Go Down

Topic: how to refresh lcd properly (Read 2501 times) previous topic - next topic

lax123

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?

Abhisheik

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);

Quote
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...

floresta

#2
Jul 16, 2012, 04:51 pm Last Edit: Jul 16, 2012, 05:02 pm by floresta Reason: 1
Quote
and lot of people will suggest more efficient coding

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

Try this one: http://arduino.cc/forum/index.php?topic=94633.0


Don

lax123

thx a lot,
this is great:
http://liudr.wordpress.com/2012/01/16/sprintf/

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.

Go Up