School project.

Dependencies:   Timezone NTPClient BSP_DISCO_F746NG Grove_temperature

Revision:
14:3ac7c08dbc52
Parent:
13:41debc0b9063
Child:
15:638e65c37d58
--- a/main.cpp	Mon Jan 18 13:39:58 2021 +0000
+++ b/main.cpp	Mon Jan 18 16:13:13 2021 +0000
@@ -45,40 +45,36 @@
 #include "rotary_functions.h"
 #include "sc_functions.h"
 #include "button_functions.h"
-
+#include "main_functions.h"
 
-void update_readings()
-{
-    light_sensor_reading = light_sensor.read();
-    light_intensity = helper_get_sensor_read_in_percent(light_sensor_reading);
-    rotary_reading = rotary.read();
-    rotary_setting = helper_get_sensor_read_in_percent(rotary_reading);
-}
 
 int main(){
     
     lcd_initialize();
     lcd_show_setup_screen();
-    //setup_run_setup();
+    setup_run_setup();
     
     bool is_fahrenheit = false;
     
     lcd_upper_right();
     
     Thread serial_communication;
-    //serial_communication.start(&sc_run_service);
+    serial_communication.start(&sc_run_service);
     
     lcd_lower_right();
-        lcd_upper_right();
-        lcd_lower_left();
-        lcd_update_lower_left(building, room);
+    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);
-        wait_us(500000);
-        
+        wait_us(1000000);
+
         /** Code for testing temperature sensor
             1/18/2021 - Working
         */
@@ -86,8 +82,8 @@
         printf("Current temperatur is: %2.2f\n", temp.getTemperature());
         wait_us(1000000);
         */
-        
-        /** Code for testing that the rotary can control the LED light blinking 
+
+        /** Code for testing that the rotary can control the LED light blinking
             1/14/2021 Working
         */
         /**
@@ -96,8 +92,8 @@
         led_set_blink_rate(rotary_reading);
         wait_us(2000000);
         */
-        
-        /** Code for testing if rotary has been turned or not 
+
+        /** Code for testing if rotary has been turned or not
             1/14/2021 Working
         */
         /**
@@ -111,9 +107,9 @@
         }
         wait_us(1000000);
         */
-        
+
         /** Code for testing sensor readings
-            1/14/2021 Working 
+            1/14/2021 Working
         */
         /**
         light_sensor_reading = light_sensor.read();
@@ -123,18 +119,18 @@
         led_set_blink_rate(light_sensor_reading);
         wait_us(1000000);
         */
-        
+
         /** 1/13/2021 Used to test the controller and make sure that it functions.*/
         /**
         printf("This is a test.\n");
         myled = 1;
         wait_us(1000000);
-        myled = 0;        
+        myled = 0;
         wait_us(1000000);
         */
-    }
 
-    /**
-    printf("Mbed OS version: %d,%d,%d\n\n",MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
-    */
+        /**
+        printf("Mbed OS version: %d,%d,%d\n\n",MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
+        */
+    }    
 }
\ No newline at end of file