cancel
Showing results for 
Search instead for 
Did you mean: 

how to disp a float value on TFT screen with STM32F429ZI ?

kadir ustun1
Senior

Hello everyone, I try to disp float value on TFT Screen with STM32F429ZI. But, sprintf function is not work. Can you help me ? please.

float fff = 0.85;

    char s_TextMsg[20];

    sprintf(s_TextMsg,"%.2f",fff);

    snprintf(s_TextMsg,20,"%.2f",fff);

    GUI_DispStringAt(s_TextMsg,110,140);

3 REPLIES 3
AvaTar
Lead

You left important details out.

What IDE/libraries you use in your project ?

Many toolchains set size-reduced libs as default, which do not contain code for floating point support in scanf/printf functions (beside others).

BTW:

[quote]float fff = 0.85;[/quote]

You do not assign a float value here.

kadir ustun1
Senior
kadir ustun1
Senior

Thank you for answered I use TrueStudio for IDE. this link solved my problem.

https://ciastkolog.pl/elektronika/stm32truestudio-funkcje-printf-sprintf-a-zmienne-float-i-double/