6 years, 2 months ago.

Output is not showing on the console

#include "mbed.h"

DigitalOut myled(LED1);
Serial pc(USBTX,USBRX);

int main() {
    pc.baud(9600);
    while(1) {
        pc.printf("hello");
        printf("Hello");
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

Today I created the sample project as shown in above and I selected the wiznet device w7500 but printing the data on console is not working and I used "Cool Term" as console. if I used the old project printing the data on console is working fine.

1 Answer

6 years, 2 months ago.

Hi Irayya, Since you have defined a serial object, it is recommended that you invoke printf on the same object throughout the program.

"pc.printf()"

Also, could you please point us to your old project that prints data to the console that you used as reference?

Thanks, Naveen, team mbed

Also, it would be helpful to know if you used Online compiler or Command Line Compiler for this exercise.

posted by Naveen Kaje 11 Sep 2018

Hi,

I tried your code with suggested modifiacations with ARM compiler with mbed-os tip at 920db63453b6aae7ccaa992fe7c9107f6664347f (As of 9/9). It worked as expected. Please let us know if that works for you.

Thanks, Naveen

posted by Naveen Kaje 17 Sep 2018