School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
Diff: setup_functions.h
- Revision:
- 5:9a9cc43f3c2c
- Parent:
- 3:02e7aac23ff9
- Child:
- 9:fd1f07a4a0ff
--- a/setup_functions.h Wed Jan 13 13:53:02 2021 +0000 +++ b/setup_functions.h Thu Jan 14 08:16:03 2021 +0000 @@ -21,7 +21,7 @@ void setup_confirm() { char answer; - printf("Type y for Yes, n for no: "); + printf("Type y for Yes, n to redo: "); scanf("%1s",&answer); if (answer == 'y' || answer == 'Y') { @@ -43,7 +43,7 @@ void setup_show_settings() { printf("Is this correct?\n"); - printf("\n----------------------------\n"); + printf("----------------------------\n"); printf("Building: %s\n", building); printf("Room: %s\n", room); printf("----------------------------\n"); @@ -56,10 +56,24 @@ */ void setup_set_room_and_building() { + char temp; + + /** 1/14/2021 + When using %s, string will be terminated when white space i found. + Therefore, set it to read white spaces with %[^\n] + Also, changed wording to reduce "please" sentences.*/ + /** printf("Please set the building (maximum 30 characters): "); scanf("%30s", building); printf("Please set the room (maximum 30 characters): "); - scanf("%30s", room); + scanf("%30s", room); */ + printf("Enter name of building (maximum 30 characters): "); + scanf("%[^\n]", building); + printf("Enter name of room (maximum 30 characters): "); + /// temp statement to clear buffer + scanf("%c", &temp); + scanf("%[^\n]", room); + setup_show_settings(); }