Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ELEC350_Project2 SDcard
Revision 7:393fa8184388, committed 2018-12-17
- Comitter:
- Swabey89
- Date:
- Mon Dec 17 16:10:40 2018 +0000
- Parent:
- 6:5646450f583b
- Child:
- 8:ee8f65745141
- Commit message:
- files created with date
Changed in this revision
| SDCard.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SDCard.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SDCard.cpp Sun Nov 18 15:19:36 2018 +0000
+++ b/SDCard.cpp Mon Dec 17 16:10:40 2018 +0000
@@ -1,10 +1,9 @@
#include "SDCard.hpp"
-
-
+#include <string>
void SDcard(void)
{
-
+ static time_t seconds;
//REQUIRES IMPROVEMENTS, SEE ONENOTE
@@ -21,20 +20,26 @@
fs = new FATFileSystem("sd", &sd);
//Open to WRITE
- fp = fopen("/sd/q.csv","a");
+
+ char fileDate[30];
+ seconds = time(NULL);
+ timeData = localtime(&seconds);
+ set_time(mktime(timeData));
+ strftime(fileDate, 30, "sd/sampledata/%d_%m_%y.csv", timeData);
+
+ fp = fopen(fileDate,"a");
if (fp == NULL) {
error("Could not open file for write\n");
lcd.cls();
lcd.printf("CANNOT OPEN FILE\n\n");
errorCode(FATAL);
- }
-
+ }
fclose(fp);
//Last message before sampling begins
lcd.cls();
- lcd.printf("READY\n\n");
+ lcd.printf("SYSTEM READY\n\n");
@@ -87,4 +92,5 @@
{
//Signal that the SD thread is still alive
//puts("SD THREAD ALIVE\n");
-}
\ No newline at end of file
+}
+
--- a/SDCard.hpp Sun Nov 18 15:19:36 2018 +0000 +++ b/SDCard.hpp Mon Dec 17 16:10:40 2018 +0000 @@ -6,6 +6,8 @@ #include "serial_terminal.hpp" #include "mbed_events.h" +extern time_t seconds; +extern tm* timeData; extern EventQueue SDqueue; extern FILE* fp; extern FATFileSystem* fs;
