I thought to use the scanf() function to get the user's choice from a displayed menu over the UART0 but it doesn't stop at the scanf() function to wait for a user input... and simply rushes endlessly the while(1) loop executing the default from the switch case.
Why? I went through this interessting post http://sekrit.de/webdocs/c/beginners-gu ... scanf.html but couldn't fix my issue though...
Code: Select all
while(1){
int choice = 0;
... some printf() ...
printf("Your choice:");
scanf("%1d", &choice);
switch(choice){
case 1: // Lists files and folders of SD card
list_sd_data();
printf("Hit any key to go back");
scanf( %*d");
break;
default:
printf("Yet not implemented\n");
break;
}
}