Initial Publish Leaning GPS/SDCARD

Dependencies:   FileManager GPSGms6 SDFileSystem mbed

Fork of 2545_SD_Card by Craig Evans

Revision:
10:43fc07923c7f
Parent:
9:4d0c81290638
diff -r 4d0c81290638 -r 43fc07923c7f main.cpp
--- a/main.cpp	Mon May 09 11:38:22 2016 +0000
+++ b/main.cpp	Tue May 10 09:24:20 2016 +0000
@@ -5,7 +5,7 @@
 
 
 // Connections to SD card holder on K64F (SPI interface)
-SDFileSystem sd(PA_7, PA_6, PA_5, PA_0, "sd"); // MOSI, MISO, SCK, CS
+SDFileSystem sd(PA_7, PA_6, PA_5, PA_0, DEVICE_NAME); // MOSI, MISO, SCK, CS
 Serial serial(USBTX, USBRX);  // for PC debug
 GPSGms6 gps;
 Timeout t1;
@@ -25,14 +25,22 @@
     printf("\r\nGps long = %s", gps.latestGPRMC().longitude);
     printf("\r\nGps indicator = %s", gps.latestGPRMC().indicator);
 
-    logGPSData( gps.latestGPRMC().date, gps.latestGPRMC().time);
+    time_t seconds = time(NULL);
+    logGPSData( (long) seconds,gps.latestGPRMC().date, gps.latestGPRMC().time);
     serial.printf("\r\n#### Restart Timer #####");
     
     tm t = gps.UTCTime();
     printf("\r\n UTC Time is %d/%d/%d %d:%d", t.tm_mday , t.tm_mon , t.tm_year , t.tm_hour, t.tm_min);
     
-    time_t seconds = time(NULL);
+   
     printf("\r\nTime as a basic string = %s", ctime(&seconds));
+    struct tm * ptm;
+    
+    time ( &seconds );
+    
+    ptm = localtime ( &seconds );
+    printf ("\r\nCurrent time around the World:");
+    printf ("\r\nPhoenix, AZ (U.S.) :  %2d:%02d\n %d-%d-%d", (ptm->tm_hour)%24, ptm->tm_min, t.tm_mday , t.tm_mon , t.tm_year);
     t1.attach(&t1out,gps_interval);
 }
 
@@ -55,13 +63,23 @@
         serial.printf("\r\n first addr name = %s ",var_list[i].varAddress);
     }
 
+    delete_file("/sd/2009-09-28.rtl.csv");
     ///////////////////////////////////////////////////
     serial.printf("\r\n####  End of SD Card Initialization #####");
     gps.start_GPS();
     t1.attach(&t1out,gps_interval);
+    set_time(1460279787);  // Set RTC time to Sun, 10 Apr 2016 09:16:27 GMT
     
-    set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
-    while(1);
+    
+    while(1){
+        
+        wait(5);
+        time_t seconds = time(NULL);
+        seconds = time(NULL);
+        float varList[] =  { 1.0,2.2,3.1};
+        logRMSData(seconds,varList, 3);
+          
+    }
 }