Hi all!
Happy New year!
I started a project with an Ili9341 display and a BME280 sensor.
There are no decimals after the comma in the display when reading the different value out, Float and then made Float to string, when I simulate, not tested in real world. It only shows the integers.
Am I doing something wrong or is there a bug. I have a similar project in FC8 and it works, also in in simulation, ok with a LCD display.
The attached is a clip from the program, to make it easier to see what is happening. When I am finish I will share the hole project
Hope someone can help
Br jorgen
Float to String, not working! SOLVED!
-
- Posts: 615
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 509 times
- Been thanked: 132 times
Float to String, not working! SOLVED!
- Attachments
-
- BME280Ili9341No Float.fcfx
- (26.03 KiB) Downloaded 199 times
Last edited by jgu1 on Sat Jan 02, 2021 7:34 am, edited 1 time in total.
-
- Matrix Staff
- Posts: 1465
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 515 times
- Been thanked: 474 times
Re: Float to String, not working!
Hi Jorgen,
Thank you & happy new year to you as well.
Your issue is you have used the function which is Integer to String.
As it is typecasting to an integer, no decimal points will be expected, so it's left out.
What you need to use instead is use
If you want to round the string to 2 decimal places for example , you can use
Thank you & happy new year to you as well.
Your issue is you have used the
Code: Select all
ToString$
As it is typecasting to an integer, no decimal points will be expected, so it's left out.
What you need to use instead is use
Code: Select all
FloatToString$
Code: Select all
HumStr = FloatToString$ (Hum, 2)
Martin
-
- Posts: 615
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 509 times
- Been thanked: 132 times
Re: Float to String, not working!
Hi MArtin!
Of course Martin, how can I have overlooked it. Also what I have used the Float to String in previus project in FC8 Now it works as it should.
And, ok this is new to me: (Hum, 2) I always edit this When I create new String vaiable, but this is easyer. Learn some new today.
Glad we have supporters like you. Many thanks for the help.
Br Jorgen.
Of course Martin, how can I have overlooked it. Also what I have used the Float to String in previus project in FC8 Now it works as it should.
And, ok this is new to me: (Hum, 2) I always edit this When I create new String vaiable, but this is easyer. Learn some new today.
Glad we have supporters like you. Many thanks for the help.
Br Jorgen.
-
- Matrix Staff
- Posts: 1465
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 515 times
- Been thanked: 474 times
Re: Float to String, not working! SOLVED!
You're welcome & thank you for the update.
I will request it to be added.
I'm glad I have shown you something new, Shame it's not in the Wiki.
I will request it to be added.
Martin