I have a 3.5" TFT device and I want to print some numbers on the screen (nice easy proportional fonts), but I don't want "stray characters" upon are redraw if the number size is different).
for example data = 31.2 lcd.print(data,1); // prints 31.2 data = 0.1 lcd.print(data,1); // prints 0.12 (note the shift in number of digits leave the stray 2
I'm printing a whole column of numbers and want the decimals to line up--hence remembering the old value and writing over it is not an option.
My doubles will never exceed 999 and never be negative. For example
Number result (decimals should line up but may not on this HTML page) 122.2 122.2 97.6 97.6 0.1 0.1 0 0.0
I’ve messed with sprintf but can’t figure out how to force 3 decimals but have 0 in the first if needed.
I can't be the only one who has ever done this, any suggestions?