Residual characters on the LCD

Hi folks,

I am printing a value on my LCD that goes from 0 to 500.
When going back decimal places, the numbers to the left remain so instead of 10 I see x10, and instead of 0 again I see xx0.

How can this be solved?

Regards

Pad your numbers with spaces so that they always occupy three positions.

I am printing the ADC value that goes from 0 to 1023. How do I add spaces into that?

You will need to test the value returned with if statements. If less than 10, print three leading spaces, if the number is from 99 to 10 print two leading spaces. If the number is from 999 to 100 print one leading space.

Thanks, I was doing exactly that (and thinking to myself how ridiculous it was) :grin:

As it stands this solved the problem.

 tft.print ((sensorValue)*(500.0/1023.0),0);
tft.print ("  ");