It seems there is an issue with online compiler. So I’d suggest to import this demo project into the Mbed StudioIDE and build it offline for the ARCH_MAX target using Mbed OS 6.4.0. It worked fine for me.
Please notice that it prints to UART1 (pins PA_9, PA_10) available on the UART header next to the JTAG/SWD header .