Continue to Site

# 5 digits 7segment display

Status
Not open for further replies.

#### johnny78

##### Full Member level 3
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:

#### KlausST

##### Super Moderator
Staff member
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

#### paulfjujo

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
How do you send this value to 7 segm..

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

### johnny78

Points: 2

#### johnny78

##### Full Member level 3
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,

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
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:

#### KlausST

##### Super Moderator
Staff member
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

#### johnny78

##### Full Member level 3
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.
you help is very Appreciated
Johnny

Last edited:

#### KlausST

##### Super Moderator
Staff member
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

#### johnny78

##### Full Member level 3
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
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 will another segment to show the minus sign i was planning for it

thanks
Johnny

#### KlausST

##### Super Moderator
Staff member
Hi
i have tried to read this file but i couldnt find an app to open md file
???
No need for an app. The text already shown.
As said: just scroll down.

Klaus

#### johnny78

##### Full Member level 3
Hi

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

Klaus
Hi

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

#### KlausST

##### Super Moderator
Staff member
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

#### johnny78

##### Full Member level 3
Hi

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

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.