CE201 Embedded : 2022-23 / Mbed 2 deprecated Car

Dependencies:   mbed

Revision:
3:147e7a35d2c3
Parent:
2:7cb9c966a781
Child:
4:54544a7dcbe0
--- a/main.cpp	Thu Feb 16 16:00:18 2017 +0000
+++ b/main.cpp	Thu Feb 16 17:33:01 2017 +0000
@@ -20,7 +20,7 @@
 int US4_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
 int US5_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
 
-std::string telemFile;          //file holding info about 
+std::string telemFile;          //file holding info about telem data gathered since last power on
 
 void setActiveUS(int chan);
 
@@ -78,7 +78,10 @@
     return result;      //should just do "return [operation that gives result];" for efficiency
 }
 
+// Opens set file for logging, appends some data, then returns.
+// 
 void telemSave(std::string data) {
-    std::ofstream file;
-    
+    std::ofstream stream;
+    stream.open(telemFile, std::ios::app);
+    stream << data;
 }
\ No newline at end of file