hi Guys
i need to display my scale weight on 5 digits 7 segment display
i've used Dean reading Arduino library for this & it works for 5 digits
how to display numbers with decimal point?
ive tried to declare the variable as float but it didnt work
Code:
float test = 99.5;
this shows number 100 on the display
i have read about the data types But i couldnt understand why it shows 100
I usually try to use fixed decimals.
So if 2 decimals, then the range is 0.00 to 999.99.
I treat it as an integer with range of 0 to 99999.
So basically this means a range of 1:100000 , which is more than a 16 bit variable can handle.
So it's not only the decimals range we need to know, but also the resolution ..
and if the value is signed .. and how to treat it.
hi Guys
i need to display my scale weight on 5 digits 7 segment display
i've used Dean reading Arduino library for this & it works for 5 digits
how to display numbers with decimal point?
ive tried to declare the variable as float but it didnt work
Code:
float test = 99.5;
this shows number 100 on the display
i have read about the data types But i couldnt understand why it shows 100
I usually try to use fixed decimals.
So if 2 decimals, then the range is 0.00 to 999.99.
I treat it as an integer with range of 0 to 99999.
So basically this means a range of 1:100000 , which is more than a 16 bit variable can handle.
So it's not only the decimals range we need to know, but also the resolution ..
and if the value is signed .. and how to treat it.
The documentation tells me the "..F" is for float numbers. And 99.5 is a float number. No integer.
****
0.00 to 999.99: so it´s fixed two decimals.
How do you want to treat negative numbers, because obviously -999.99 is not possible.
resolution:
with a 5 digit you may show positive values 0.0000 ... 0.0001 (or even .00001) .... 99999
so the resolution could theoretically be .00001 (10 micro) and dynamically adjust the number of decimals.
i may get 000.00 to 999.99 but sometime when u carry out the load of the scale it may give negative value
because of the mechanical springs .
its small vallue like -001.00 lets say so its not important much but im interested to know how can i solve this issue
resolution:
with a 5 digit you may show positive values 0.0000 ... 0.0001 (or even .00001) .... 99999
so the resolution could theoretically be .00001 (10 micro) and dynamically adjust the number of decimals.
In post#1 you posted a link to the GitHub library with it´s readme.md. Just scroll down a bit.
It tells you the difference between setNumber and setNumberF and how to use them.
Negative values:
You are free to differentiate between negative and positve values.
So you are free to use 000.00 to 999.99 as positive values
and -00.00 to -99.99 as negative values (mind the most left digit is used as "minus" sign, leaving just 4 (out of 5) digits to show values.
In post#1 you posted a link to the GitHub library with it´s readme.md. Just scroll down a bit.
It tells you the difference between setNumber and setNumberF and how to use them.
Negative values:
You are free to differentiate between negative and positve values.
So you are free to use 000.00 to 999.99 as positive values
and -00.00 to -99.99 as negative values (mind the most left digit is used as "minus" sign, leaving just 4 (out of 5) digits to show values.
i've tried to read it from the downloaded file first
then i opened it in the github
it was the same method but the version i was using is older & seems like it does'nt support this feature
i have used:
(float test=987.5)
(sevseg.setNumberF(test))But i didnt get a decimal point
then used this
(sevseg.setNumberF(test, 1);& the decimal point is here finally
what is the 1 added after the test variable? that was mentioned by Paulfjuju?
What are yo doing?
No need to open a file. Click on your link in post#1 (github) and then, again: just scroll down.
The functions and their parameters are explained there.
(Do we see a different internet page than you ???)
In either case it should be possible to do a browser search for "setNumberF" on the github page.
i've tried to read it from the downloaded file first
then i opened it in the github
it was the same method but the version i was using is older & seems like it does'nt support this feature
i have used:
(float test=987.5)
(sevseg.setNumberF(test))But i didnt get a decimal point
then used this
(sevseg.setNumberF(test, 1);& the decimal point is here finally
what is the 1 added after the test variable? that was mentioned by Paulfjuju?