printf not printing floats under mbed

Sysprogs forums Forums VisualGDB printf not printing floats under mbed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11389
    smartsystemdesign
    Participant

    I have created a new VisualGDB project using the Embedded project wizard, MSBuild, mbed, and the LEDBlink sample project.  I added two printf statements to main as shown below.  I am using a Nucleo-L432KC board from ST.  The problem is that the second printf statement doesn’t print anything.  The first printf works fine and prints 1.  Please help.

     

    int main()
    {
    for (;;)
    {
    printf(“%d\t”, 1);
    printf(“%f\r\n”, 1.5f);

    g_LED = 1;
    wait_ms(500);
    g_LED = 0;
    wait_ms(500);
    }
    }

    #11390
    jmkresse
    Participant

    I would suggest trying

    printf(“%f\r\n”, 1.5);

    to see if that works for you.

    #11393
    support
    Keymaster

    Hi,

    This may happen because the default implementation of printf() in the newlib-nano library does not support floating-point numbers. Please try explicitly switching to the “newlib-nano with floating-point support” via VisualGDB Project Properties.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.