5 digits 7segment display

Status
Not open for further replies.

johnny78

Full Member level 5
Joined
Jun 28, 2017
Messages
270
Helped
1
Reputation
2
Reaction score
5
Trophy points
1,298
Activity points
3,462
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

what do u suggest ?

here is the Library i use

thanks
Johnny
 
Last edited:

Hi,

Fixed?
Or variable? In which range?

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.

Klaus
 

How do you send this value to 7 segm..

Code:
test=99.5;
sevseg.setNumberF(test,1);
 

    johnny78

    Points: 2
    Helpful Answer Positive Rating
How do you send this value to 7 segm..

Code:
test=99.5;
sevseg.setNumberF(test,1);
hi Mr

i use sevseg.setNumber(test);
why you use F & (test,1);?

thanks
--- Updated ---

Hi
its variable value i get from an electronic scale
yes the reange is 0.00 to 999.99.

what do you mean by resolution ?
signed you mean like negative value with -?
yes sometimes it is & i should add another segment to display this

thanks
Johnny
 
Last edited:

Hi,
why you use F & (test,1);?
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.

Klaus
 

    johnny78

    Points: 2
    Helpful Answer Positive Rating
Hi,

The documentation tells me the "..F" is for float numbers. And 99.5 is a float number. No integer.
****
which documentation ? like Arduino reference ?
why using the 1 after the varible ?

sevseg.setNumberF(test,1);

anyway i have tried this method but it gives me error when compiling
'class sevseg' has no member named 'setNumberF'.
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.
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.
thanks for the direct answer
you help is very Appreciated
Johnny
 
Last edited:

Hi
which documentation ? like Arduino reference ?
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.

Klaus
 

Hi

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.
i have tried to read this file but i couldnt find an app to open md file
will google it
i will another segment to show the minus sign i was planning for it

thanks
Johnny
 

Hi

???
No need for an app. The text already shown.
As said: just scroll down.

Klaus
Hi

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?

thanks
Johnny
 

Hi,

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.

Klaus
 

    johnny78

    Points: 2
    Helpful Answer Positive Rating
Hi

Got it finally

Floats are supported. In this case, the second argument indicates how many decimal places of precision you want to display.

its all done i guess

thank you
Johnny
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…