School project.

Dependencies:   Timezone NTPClient BSP_DISCO_F746NG Grove_temperature

Revision:
13:41debc0b9063
Parent:
12:50b76050d163
Child:
14:3ac7c08dbc52
--- a/main.cpp	Mon Jan 18 07:41:31 2021 +0000
+++ b/main.cpp	Mon Jan 18 13:39:58 2021 +0000
@@ -26,12 +26,17 @@
 
 AnalogIn light_sensor(A0);
 AnalogIn rotary(A1);
+DigitalIn button(D5);
 PwmOut led(D3);
 Grove_temperature temp(A2);
 char building[31];
 char room[31];
+float light_sensor_reading;
+float rotary_reading;
+int light_intensity;
+int rotary_setting;
 
-/** DigitalOut myled(LED1); */
+DigitalOut myled(LED1);
 
 #include "helper_functions.h"
 #include "setup_functions.h"
@@ -39,21 +44,41 @@
 #include "led_functions.h"
 #include "rotary_functions.h"
 #include "sc_functions.h"
+#include "button_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);
     
-    float light_sensor_reading;
-    float rotary_reading;
+    lcd_lower_right();
+        lcd_upper_right();
+        lcd_lower_left();
+        lcd_update_lower_left(building, room);
     while(1)
     {
+        button_switch_temp_unit(button, is_fahrenheit);
+        
+        lcd_update_lower_right(temp.getTemperature(), is_fahrenheit);
+        wait_us(500000);
+        
         /** Code for testing temperature sensor
             1/18/2021 - Working
         */