6 years, 1 month ago.

How to do printf through USBSerial

I am trying to print to Tera Term from a Nucleo F746ZG through the USBSerial connection.

I tried:

USBSerial usb_serial;

usb_serial.printf("Interrupt\r\n");

usb_serial.printf("Temperature = %f", float);

When the printf is run the whole program just stops.

1 Answer

6 years, 1 month ago.

Hi Cara,

Are you using Mbed OS 2 or 5? If your project includes a mbed-os.lib file you are using Mbed OS 5 and can use the following Serial API to printf to the serial terminal: https://os.mbed.com/docs/v5.8/reference/serial.html#serial-hello-world

- Jenny, team Mbed