School project.

Dependencies:   Timezone NTPClient BSP_DISCO_F746NG Grove_temperature

main.cpp

Committer:
tuxx0046
Date:
2021-01-13
Revision:
0:ed4063a0a4d5
Child:
1:1ee11539cc43

File content as of revision 0:ed4063a0a4d5:

/*
@file main.cpp
@brief Light Control System to automatically dimmer or increase light levels depending on registered light intensity.

@author Tu Tri Huynh

@date 1/13/2021
*/

#include "mbed.h"


char building[31];
char room[31];
//bool is_set = false;

void setup_set_room_and_building();

void setup_confirm()
{
    char answer;
    printf("Type y for Yes, n for no: ");
    scanf("%1s",&answer);
    if (answer == 'y' || answer == 'Y')
    {
        //is_set = true;
        printf("Setup successfully completed.\n");
    }
    else
    {
        setup_set_room_and_building();
    }
    printf("setup_confirm function end\n");
}

void setup_show_settings()
{
    printf("Is this correct?\n");
    printf("Building: %s\n", building);
    printf("Room: %s\n", room);
    setup_confirm();  
}

void setup_set_room_and_building()
{
    printf("Please set the building (maximum 30 characters): ");
    scanf("%30s", building);
    printf("Please set the room (maximum 30 characters): ");
    scanf("%30s", room);
    setup_show_settings();
}

void setup_run_setup()
{
    printf("Welcome to the Light Control System initial setup process\n");
    printf("Please set the units' location...\n\n");
    setup_set_room_and_building();
}

int main(){
    /*
    printf("Mbed OS version: %d,%d,%d\n\n",MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
    */
    
    setup_run_setup();    
    printf("Setup done.");
}