Becky Page / Mbed OS Blinkcopy

Files at this revision

API Documentation at this revision

Comitter:
rebecca_page
Date:
Fri Dec 11 16:22:08 2020 +0000
Parent:
1:448ff9efcefa
Commit message:
Newest edition

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Dec 11 15:38:14 2020 +0000
+++ b/main.cpp	Fri Dec 11 16:22:08 2020 +0000
@@ -25,11 +25,11 @@
     /* Data Structures */
     
     struct dataSet {
-        float highTempThresh;
-        float lowTempThresh;
+        float highTempThresh = 26;
+        float lowTempThresh = 23;
         float ambientTemp;
-        float highLightThresh;
-        float lowLightThresh;
+        float highLightThresh = 80;
+        float lowLightThresh = 20;
         float ambientLight;
         } myData;
     
@@ -75,9 +75,17 @@
             myData.ambientTemp = (float32_t)(((1.0 / stEqn) - 273.15) + 0.5); 
             myData.ambientLight = lightLevel.read() * 100;     
 }
-void displayData() {                   
+void displayData() {  
+            if (myData.ambientTemp >  myData.highTempThresh) printf("\033[31m");  //Red Text 
+            else if (myData.ambientTemp >  myData.lowTempThresh) printf("\033[34m");  //Blue Text 
+            else printf("\033[32m"); // Green Text          
             sprintf(buffer, "Temerpature is %2.1f C", myData.ambientTemp);
             displayAt (1, 3, buffer);
+                        sprintf(buffer, "Low Threshold is %2.1f C", myData.lowTempThresh);
+            printf("\033[37m"); // default text
+            displayAt (27, 3, buffer);
+                        sprintf(buffer, "High Threshold is %2.1f C", myData.highTempThresh);
+            displayAt (55, 3, buffer);
             
             sprintf( buffer, "Ambient Light is: %3.1f%c", myData.ambientLight, 0x25 );
             displayAt(1,4, buffer);