program for final combination of working pieces

Dependencies:   SDFileSystem TMP102 mbed ISL29125

Fork of TEMP_Test by Thomas Dale

Files at this revision

API Documentation at this revision

Comitter:
tdale19
Date:
Thu Apr 07 15:46:20 2016 +0000
Parent:
11:cc9b7a7ce7cf
Child:
13:906a647d7bd1
Commit message:
Extended Timer

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Apr 06 22:47:51 2016 +0000
+++ b/main.cpp	Thu Apr 07 15:46:20 2016 +0000
@@ -15,6 +15,7 @@
 int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function
     float lastTime = 0;
     float interval = 0.5;
+    int halfHour = 0;
     ledRed = 0;
     ledBlue = 1;
     wait(0.5);
@@ -28,9 +29,14 @@
     uint16_t rgb[3];
     ledRed = 1;
     createDataFile();
-    while (t.read()<60) {
-        if (t.read()>(lastTime+interval))  {
-          lastTime=t.read();
+    while (halfHour < 7) {
+        if (t.read() >= 1800){
+            t.start();
+            halfHour++;
+            }
+        float totalTime = halfHour * 30 * 60 + t.read();
+        if (totalTime>(lastTime+interval))  {
+          lastTime=totalTime;
           get_rgb(rgb);
           pc.printf("temp ouside = %.2f (c)   inside = %.2f (c)   on panel = %.2f (c)   solar volage = %.2f (V)   UV light =%.4f   RGB Values: red = %d   green = %d   blue = %d\r\n" ,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar(),(get_UV()),rgb[0],rgb[1],rgb[2]);//prints titles and data of Temp readings
           writeData(lastTime,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar(),get_UV(),rgb[0],rgb[1],rgb[2]);//send data to writeData in SDsave.cpp