Code to take GPS, Accelerometer and Compass readings and print to USB for data analysis.

Dependencies:   CMPS03 FatFileSystemCpp GPS MMA7660 mbed C12832_lcd

Revision:
1:cdfeb3e3d25d
Parent:
0:2557081b4322
Child:
2:64ff9d8b2aa1
--- a/main.cpp	Wed May 07 09:49:54 2014 +0000
+++ b/main.cpp	Wed May 07 09:58:21 2014 +0000
@@ -59,13 +59,13 @@
     pc.printf("Starting CMPS03 test...\n");
     float refPoint = 1.0; 
     float bearing;
-    int i = 1;
+    int i = 0;
     
     while (1)
     {
         refPoint = compass.readBearing();
-        pc.printf(CompassFile, "The reference bearing: %f\n\n", refPoint/10);
-        while(i == 1)
+        pc.printf("The reference bearing: %f\n\n", refPoint/10);
+        while(i < 20)
         {
         // GPS code
             if(gps.sample()) 
@@ -93,13 +93,15 @@
             }
             else
             {
-                pc.printf(CompassFile, "Bearing : %f\n\n", bearing);
+                fprintf(CompassFile, "Bearing : %f\n\n", bearing);
             }
-        }        
+            i = i + 1;
+        }
+        fclose(CompassFile);
+        fclose(AccelFile);
+        fclose(GPSFile);        
     }
-    fclose(CompassFile);
-    fclose(AccelFile);
-    fclose(GPSFile);
+    
         
    /* fclose(compassFile); 
     printf("\n - OK\n");