Go Down

Topic: Fload value (Read 780 times) previous topic - next topic

gardner



Code: [Select]

    lcd.print(AFC);


The output on the LCD "2,38" volt.

My project need a more specific value. example 2,3875 volt. So 4 or maybe 5 digits more are exacter.


If you just want to see more decimal places on your display, do:

Code: [Select]

    lcd.print(AFC,4);


Of course, as other have pointed out, the extra decimals really mean nothing since the ADC on the Arduino is not that accurate.  The best you could hope for is about 1 part in 500 accuracy, on a good day, with the wind in the right direction and all that.  And the 3-figure output you've already gotten is more than good enough to represent that.

dhenry

Quote
he output on the LCD "2,38" volt.


You will need to look into lcd.print() and see if / how you can specify more digits.

Midway

Code: [Select]
lcd.print(AFC,4);

this is what I'm looking for.

shame myself, i must know this.

thanks :)

text12


Code: [Select]

    lcd.print(AFC,4);


That works great! is there a way to turn off the rounding?
For example I have a float 118.225, I only want to display the first 2 decimal places but lcd.print(COM1A); returns 118.23.

PaulS

Quote
is there a way to turn off the rounding?

Write your own function. Not rounding is not a good idea. Why do you want to do that?

Go Up