9 years, 10 months ago.

Nucleo STM32f401e printf problem with certain format codes

This works:

pc.printf("%12.6f\n",fTest);

This doesn't:

pc.printf("%12.4f\n",fTest);

In addition, 8.1 works, 8.2 works and 8.3 doesn't.

In both cases, fTest is defined:

float fTest;

and pc:

Serial pc(USBTX,USBRX);

This has been driving me crazy. Sometimes there is no output, other times the letters 'USB' show up on the screen along with the numbers I am trying to print.

I have a similar problem

pc.printf("Measurement 1: %4.2f mV \tMeasurement 2: %4.2f mV \r\n", 3.14159, 2.3);

outputs "Measurement 1: mV \tMeasurement 2: mV"

Any help would be much appreciated!

posted by Tim Lee 05 Nov 2015
Be the first to answer this question.