Skip to main content
DElli.1
Associate III
Jun 4, 2020 4:36 PM UTC
Question

How to write decimal figures to TouchGFX Text Box

Hello!

Sorry I am new to stm32 and TouchGfx.

I am currently reading from SPI and want to relay that data to the screen using:

Unicode::snprintf(textCounterBuffer, 10, "%d", finalData);

textCounter.invalidate();

my problem is that the finalData is a decimal figure and the decimal gets cut off.

When I try to display the raw data number from my spi it displays fine and is a uint8_t variable. I need to adjust this number using:

finalData = (spiRxBuf/4096)*100;

but as I said before the screen does not display the number properly.

This topic has been closed for replies.

10 replies

Tesla DeLorean
Guru
Jun 4, 2020 6:28 PM UTC

%d is integer, for a floating point double use %lf

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
DElli.1
DElli.1Author
Associate III
Jun 4, 2020 7:08 PM UTC

Wow, thanks, I feel stupid for missing that.

Thank you! ​