7 years, 2 months ago.

how to use the "printf" function and see its result, when using mbed complier

I am using mbed online compiler , and here is the source code :

  1. include "mbed.h" DigitalOut led_red(LED_RED); InterruptIn sw2(SW2); void sw2_release(void) { led_red = !led_red; printf("On-board button SW2 was released.\n"); } int main() { sw2.rise(&sw2_release); while (true) { } } Can I use printf function ? and how to get its printout result on K22F. through the primary serious port ? I am using the picocom and configured to /dev/ttyACM0 and 115200 braut in a linux environment , but didn't get any serial infomation printed out.

Question relating to:

The FRDM-K22F is an ultra-low-cost development platform for Kinetis K Series K2x (K22F) MCUs built on ARM® Cortex™-M4 processor. Features include easy access to MCU I/O, battery-ready, low-power operation, a …

1 Answer

7 years, 2 months ago.

It goes via the USB-SDA port, on the COM port that should be available on that one. The default baudrate is 9600 and not 115200.