Scanf problem?

24 Nov 2016

Hi,

I am having some trouble with scanf. I have been testing with a small example (see below). When the program executes, the scanf function blocks and waits for my input. The input is then printed to the screen. In the next loop, the same should happen, but it seems the scanf function is directly left again (without blocking and waiting for input).

Anyone any idea what the reason could be?

  1. include "mbed.h"

uint32_t number;

int main() {

while(1) {

scanf("%d", &number);

printf("number = %d \r\n", number);

wait(1);

}

}