Serial class in Mbed OS 6?

Hello Da Dude,

In Mbed OS 6 you can use either BufferedSerial or UnbufferedSerial.

You can also use the “serial console” to communicate with the PC over a virtual USB serial port associated with the USBTX, USBRX pins . It uses the STDIO device. Simply call the global printf function:

printf("Prints to the virtual serial port\r\n");

I works at 9600 bit/s.

For debug messages you can also call the global debug function. It works like the global printfbut it is automatically optimized away (no debug messages are printed) if you build the project using the release profile:

debug("This message is optimized away (not printed) in release build");

It is also possible to remap the “serial console” to other than the USBTX, USBRX pins.

Best regards, Zoltan