Problem with Serial

Hello, Please, help:
Problem with Serial in VisualStudio Code:

If I use Serial printf or putc, then microcontroller Stop - Hover and led1 not blinking
DigitalOut led1(PA_5);
DigitalOut ledPA3(PA_8);

Serial pc(PA_2, PA_3);

int main() {

// put your setup code here, to run once:
//pc.printf(“Hello World\n\r”);

while(1) {
wait_ms(200);
led1 =1;
ledPA3=0;
wait_ms(400);
led1 =0;
ledPA3=1;
//pc.printf(“Hello World\n\r”);
//pc.putc(pc.getc()+1);
}
}

Hi there,

the code works exactly how you wrote it, from my point of view.
Why the board stops? The board not stop but is waiting for input from serial. Because the method pc.getc() inside pc.putc(pc.getc()+1); will stay until you not send a char from your pc.
So simply send a number from your serial terminal to your board and then the board will reply your number +1 and loop will be done and will starting again.

BR, Jan