Go Down

### Topic: how to get 4 digit decimal no. (Read 898 times)previous topic - next topic

#### maibam

##### Mar 08, 2013, 02:12 pm
i interface with analog voltage at pin no A0 and get the data. than i convert the data in to voltage but it has been showing upto 2 digit no not upto 4 digit no. but i need upto four 4 digit no so how can i get the value up to 4 digit no any suggestion.

#### AWOL

#1
##### Mar 08, 2013, 02:21 pm
Code: [Select]
`Serial.print (myFloatVoltage, 4);`
But, with 4mV resolution, this may not be what you want.

(post your code if you want help)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

#### robtillaart

#2
##### Mar 08, 2013, 10:06 pm
do you mean preceding zero's?  e.g. 0024 mV?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### BlackSnake

#3
##### Mar 09, 2013, 04:36 am
With a print function you can define how many 0's you want after the decimal point
ie print(a0,2); will print to 2 decimal places.
I use this for voltages myself but I have found sometimes if the voltage is under ten and using an LCD 2 line display I will get 3 decimal places instead of 2.
Not sure if this problem occurs on serial monitor.
Hope this helps

#### robtillaart

#4
##### Mar 09, 2013, 08:13 am
Quote
I use this for voltages myself but I have found sometimes if the voltage is under ten and using an LCD 2 line display I will get 3 decimal places instead of 2.

Can you make a test application that shows this behaviour?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### PaulS

#5
##### Mar 09, 2013, 01:53 pm
Quote
Can you make a test application that shows this behaviour?

I'd guess that it only happens when the value drops from over 10 to under 10, and OP isn't clearing the LCD display.

Go Up

Please enter a valid email to subscribe