Rough Draft, still some debugging to be done. Considering getting rubber ducky

Dependencies:   mbed SDFileSystem DS1820 ExtendedTimer

Files at this revision

API Documentation at this revision

Comitter:
hzelayasolano22
Date:
Tue Apr 16 22:14:55 2019 +0000
Parent:
3:2092eac3cd15
Commit message:
Final Draft! Code is ready to go

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Apr 16 05:28:36 2019 +0000
+++ b/main.cpp	Tue Apr 16 22:14:55 2019 +0000
@@ -19,7 +19,6 @@
 DS1820* probe2[MAX_PROBES];
 DS1820* probeTail[MAX_PROBES];
 SDFileSystem fs(p5, p6, p7, p8, "fs");
-Serial pc(USBTX, USBRX);
 ExtendedTimer t;
 Ticker sampleTime;
 Ticker saveTime;
@@ -78,9 +77,6 @@
         }
     
     //Writing headers for each file!
-    fprintf(out1, "Time (s) \t Tempurature (deg C)\r\n");
-    fprintf(out2, "Time (s) \t Tempurature (deg C)\r\n");
-    fprintf(out3, "Time (s) \t Tempurature (deg C)\r\n");
     fprintf(out1, "Found %d device(s)\r\n", num_arm1);//lets user know how many sensors were read during the actual flight
     fprintf(out2, "Found %d device(s)\r\n", num_arm2);
     fprintf(out3, "Found %d device(s)\r\n", num_tail);
@@ -99,38 +95,52 @@
         fprintf(out3, "\tID%d = ", i);
         fprintf(out3, "%llX\r\n", fullName);
         }
+//Formatting of Data 
+
+    fprintf(out1, "Sensors:    ");
+    fprintf(out2, "Sensors:    ");    
+    fprintf(out3, "Sensors:    ");    
+    for(int i = 0; i < num_arm1; i++){
+        fprintf(out1, "%d    ", i);
+        }
+    for(int i = 0; i < num_arm2; i++){
+        fprintf(out2, "%d    ", i);
+        }
+    for(int i = 0; i < num_tail; i++){
+        fprintf(out3, "%d    ", i);
+        }   
+    fprintf(out1, "\r\n");
+    fprintf(out2, "\r\n");
+    fprintf(out3, "\r\n");
+        
 //timer starts
     t.start();  
     
     while(t.read() < (60*60*4)){ //4 hours of data
-        /*if(timeToRead == true){
-            timeToRead = false;//resets the clock*/
-            
-
+            led1 = 1;
             probe1[0]-> convertTemperature(true, DS1820::all_devices);//convert all the temperature sensors
             probe2[0]-> convertTemperature(true, DS1820::all_devices);
             probeTail[0]-> convertTemperature(true, DS1820::all_devices); 
-            led1 = 1;
+            led4 = 1;
         //print data from arm 1
-            fprintf(out1, "Time: %3.1f\r\n", t.read());
+            fprintf(out1, "%3.1f(s)    ", t.read());
             //get temp from sensors
             for(int i = 0; i < num_arm1; i++){
-                fprintf(out1, "Sensor %d = ", i);//each numbered, helps keep track of temperature sensors
-                fprintf(out1, "%3.1f\r\n", probe1[i]->temperature());
-               /* fprintf(out1, "\r\n");*/
+                fprintf(out1, "%3.1f ", probe1[i]->temperature());
                 }
-            fprintf(out2, "Time: %3.1f\r\n", t.read());
+            fprintf(out1, "\r\n");    
+                
+            fprintf(out2, "%3.1f(s)    ", t.read());
             for(int i = 0; i < num_arm2; i++){
-                fprintf(out2, "Sensor %d = ", i);
-                fprintf(out2, "%3.1f\r\n", probe2[i]->temperature());
-                /*fprintf(out2, "\r\n"); */ 
+                fprintf(out2, "%3.1f ", probe2[i]->temperature());
                 }
-            fprintf(out3, "Time: %3.1f\r\n", t.read());
+            fprintf(out2, "\r\n");    
+            fprintf(out3, "%3.1f(s)    ", t.read());
             for(int i = 0; i < num_tail; i++){
-                fprintf(out3, "Sensor %d = ", i);
-                fprintf(out3, "%3.1f\r\n", probeTail[i]->temperature());
-               /* fprintf(out3, "\r\n");*/
+                fprintf(out3, "%3.1f ", probeTail[i]->temperature());
                 }
+            fprintf(out3, "\r\n");    
+                
         led3 = 1;
         fclose(out1);
         fclose(out2);