Hi,
I made a counter was I showed on LCD 16x2 and the last character( zero) remain when I do decrease the counter
How I clear the last character ?
Thanks in advance
write a space when the number has been decremented only if the number of digits has reduced
Although that is the sophisticated way of doing it frankly I would not bother. Just print a trailing space or spaces after the number. If the number is close to something else on the screen and hence there is a danger of overwriting it if a fixed number of spaces is written after a long number then consider writing a variable number of spaces based on the size of the number and forget about checking whether it is strictly necessary
Something like
lcd.print(number);
if (number < 10)
{
lcd.print(" "); //3 spaces
}
else if (number < 100)
{
lcd.print(" "); //2 spaces
}
else
{
lcd.print(" "); //1 space
}
Print the fixed text once in setup() then only print data when it changes. If the screen has anything printed on it after the number then you have to be careful about how many blanking spaces you print to avoid overwriting any of it