Program to read data from sensors, write them to a file which can then be interpreted by software to help show the path of a bicycle as it travels around a field

Dependencies:   C12832_lcd FatFileSystemCpp MMA7660 CMPS03 GPS

Fork of MSCUsbHost by Igor Skochinsky

Program to link a compass and a GPS to an MBED to produce a CSV file which can be used to track a bicycle around a field

Results can be found here

Revision:
11:c85911a4c956
Parent:
10:d2dd3b355de5
Child:
13:0dd713c97cd1
--- a/main.cpp	Thu Mar 16 15:52:05 2017 +0000
+++ b/main.cpp	Thu Mar 16 17:01:46 2017 +0000
@@ -6,7 +6,7 @@
 #include "MSCFileSystem.h"
  
 #define FSNAME "USB"
-#define LIM 60
+#define LIM 200
  
 GPS gps(p9, p10); // GPS Connection
 CMPS03 compass(p28, p27, CMPS03_DEFAULT_I2C_ADDRESS); // Compass connection
@@ -47,22 +47,22 @@
         fprintf(Accel,"%f, %f, %f,\r\n",ax,ay,az);
         lcd.locate(1,21);
         lcd.printf("Accel: %.2f, %.2f, %.2f", ax, ay, az);
-/*                
+                
         //GPS
         GPS = fopen("/USB/GPS.csv", "a");
         if (gps.sample())
         {
-            fprintf(GPS, "\n%f, %f\r\n", gps.latitude, gps.longitude);
+            fprintf(GPS, "\n%f, %f, %f\r\n", gps.latitude, gps.longitude, gps.time);
             lcd.locate(1,1);
-            lcd.printf("%.4f, %.4f, %.4f", gps.latitude, gps.longitude);
+            lcd.printf("%.4f, %.4f, Time: %f", gps.latitude, gps.longitude, gps.time);
         }       
         else // For no signal
         {
-            fprintf(GPS, "\nNo Lock!\n\n");
+            fprintf(GPS, "No Lock!\n\n");
             lcd.locate(1,1);
             lcd.printf("GPS: No Lock!");
         }
- */       
+        
         // Compass
         //Offset = compass.readBearing();  // Initial definitions
         Comp = fopen("/USB/Compass.csv", "a");
@@ -91,7 +91,7 @@
         
         i++;
         fclose(Accel);
-        //fclose(GPS);
+        fclose(GPS);
         fclose(Comp);
     }