Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Lab_6_WaG by
Diff: main.cpp
- Revision:
- 2:b444464ebe67
- Parent:
- 1:1b05289d0bf5
- Child:
- 3:293ff9cb705d
--- a/main.cpp Tue Feb 20 17:17:55 2018 +0000 +++ b/main.cpp Tue Feb 20 17:24:19 2018 +0000 @@ -69,17 +69,23 @@ spi.write(0x0500); //set digit 5 to 0 float command = 0x0100; - char input[5]; + int input; //char command_text[10] = "0x0"; while(1) { pc.printf("Select a digit between 0 and 9999:\n"); - scanf("%5s", input); - while (num_range(input) == false) { //ask for input until 0-9999 is selected + bool check = scanf("%d", &input); + while (check != 1) { pc.printf("Select a digit between 0 and 9999:\n"); - scanf("%5s", input); + check = scanf("%d", &input); } /* + while (num_range(input) == false) { //ask for input until 0-9999 is selected + pc.printf("Select a digit between 0 and 9999:\n"); + scanf("%d", input); + } + + command_text[3] = place + '0'; command_text[4] = '0'; command_text[5] = input;