Problem refreshing a value with more than one digits.

Hello. I need help about how to refresh a value with more than one digit. The value is an integer (int temp;) that changes from 0 to 150.
If I read i.e. 100 and the value changes to 99, then the display shows 990, or if I read 10 and the value drops to 9, then I read 90.
To show the integer I am using lcd.print(temp); . I used lcd.clear() but it doesn't work. Thank you!

You can do this many ways:-

  1. Always print two blank spaces after each print.
  2. Look at the size of the number and print no, one or two spaces after you print.
  3. Convert into a string and pad out before or after the digits with spaces, then print the string
  4. Read back the cursor position after you print then print spaces until it gets to the end of the field.

Grumpy_Mike. I fixed it following your first recommendation. Thank you very much!.

This problem comes up quite frequently. There are some other solutions mentioned in this thread: --> http://arduino.cc/forum/index.php/topic,94633.msg710615.html#msg710615%20(http://arduino.cc/forum/index.php/topic,94633.msg710615.html#msg710615

Don