[SOLVED] how to dispay single digit as two on lcd

Hi everyone,

Im trying to figure out how to display a single number on the lcd after a double digit has been displayed on lcd with out clearing the lcd or setting the cursor and using lcd.write(254);

eg if i display 10 on lcd, and then 9, it will show 90, i dont want to clear the lcd or print clear spaces
is there a formatting option to dispay single digits as two like 9 is 09

thanks for your help

If the value is less than ten, print a space first.

Orsprintf (buf, "%2d", x);etc

AWOL,

brilliant, done my head for a while looking at sprinf examples but managed to get it to work thanks

i did it like this

lcd.setCursor(0, 5);
  sprintf (buffer, "%2u", setTemp); 
lcd.print (buffer);

thanks, now i need to seriously need to learn how to make my code easier to read i get lost with my curly brackets lol

cheers

Tiaki