Hi,
I have 1.8" Color TFT Display Shield Shield w/joystick and an Arduino Uno and it displays float numbers with 2 decimals (i.e, -2.45).
How can I make it display 4 decimals (i.e., -2.4523)?
I tried:
tft.print(varCount,4); but it didn't work.
tft.print(varCount/360); works fine but only 2 decimals. So it takes variables and do the math.
Thanks!
Decimal display
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Decimal display
tft.print( number, digits ) is the correct way to do it. None of our code actually handles the logic of deciding how to print a number.. that lives in the Print class (Print.h and Print.cpp). Our code provides the glue necessary to translate the Print class's commands into pixels on a specific display.
Post the code you're using and we'll see if we can find anything there.
Post the code you're using and we'll see if we can find anything there.
Please be positive and constructive with your questions and comments.