School project.

Dependencies:   Timezone NTPClient BSP_DISCO_F746NG Grove_temperature

Revision:
15:638e65c37d58
Parent:
14:3ac7c08dbc52
Child:
16:296d68305630
--- a/main.cpp	Mon Jan 18 16:13:13 2021 +0000
+++ b/main.cpp	Tue Jan 19 10:05:13 2021 +0000
@@ -29,13 +29,21 @@
 DigitalIn button(D5);
 PwmOut led(D3);
 Grove_temperature temp(A2);
+/// Name of building to install the unit
 char building[31];
+/// Name of room to install the unit
 char room[31];
+
 float light_sensor_reading;
 float rotary_reading;
+/// The percentage of light registered 
 int light_intensity;
+/// The percentage of rotary turned
 int rotary_setting;
 
+int current_temp;
+bool is_fahrenheit = false;
+
 DigitalOut myled(LED1);
 
 #include "helper_functions.h"
@@ -49,30 +57,26 @@
 
 
 int main(){
-    
+    bool switch_temp;
+        
     lcd_initialize();
     lcd_show_setup_screen();
     setup_run_setup();
-    
-    bool is_fahrenheit = false;
-    
-    lcd_upper_right();
+    lcd_show_main_screen();
+    lcd_update_lower_left(building, room);
+    lcd_update_upper_left();
     
     Thread serial_communication;
     serial_communication.start(&sc_run_service);
-    
-    lcd_lower_right();
-    lcd_upper_right();
-    lcd_upper_left();
-    lcd_lower_left();
-    lcd_update_lower_left(building, room);
+        
     while(1)
     {
         update_readings();
-
-        button_switch_temp_unit(button, is_fahrenheit);
-
-        lcd_update_lower_right(temp.getTemperature(), is_fahrenheit);
+        check_light_control();
+        switch_temp = button_switch_temp_unit(button, is_fahrenheit);
+        update_temperature(switch_temp);
+        switch_temp = false;
+        
         wait_us(1000000);
 
         /** Code for testing temperature sensor