Code to take GPS, Accelerometer and Compass readings and print to USB for data analysis.
Dependencies: CMPS03 FatFileSystemCpp GPS MMA7660 mbed C12832_lcd
Diff: main.cpp
- Revision:
- 2:64ff9d8b2aa1
- Parent:
- 1:cdfeb3e3d25d
- Child:
- 3:05d2d090b8b0
--- a/main.cpp Wed May 07 09:58:21 2014 +0000 +++ b/main.cpp Wed May 07 10:07:45 2014 +0000 @@ -70,11 +70,11 @@ // GPS code if(gps.sample()) { - fprintf(GPSFile, "\n%f %f\n", gps.latitude, gps.longitude); + fprintf(GPSFile, "\n%f %f\r\n", gps.latitude, gps.longitude); } else { - pc.printf("\nOh Dear! No lock :(\n") && fprintf(GPSFile, "\n0.000 0.000\n"); + pc.printf("\nOh Dear! No lock :(\n") && fprintf(GPSFile, "\n0.000 0.000\r\n"); } // Accelerometer code @@ -82,18 +82,18 @@ ax=MMA.x(); // read accelerometer values ay=MMA.y(); az=MMA.z(); - fprintf(AccelFile, "%f %f %f\n",ax,ay,az); + fprintf(AccelFile, "%f %f %f\r\n",ax,ay,az); // Compass code bearing = (compass.readBearing()/10 - refPoint/10); if(bearing < 0.0) { bearing = 360 + bearing; - fprintf(CompassFile, "Bearing : %f\n\n", bearing); + fprintf(CompassFile, "Bearing : %f\r\n", bearing); } else { - fprintf(CompassFile, "Bearing : %f\n\n", bearing); + fprintf(CompassFile, "Bearing : %f\r\n" << endl, bearing); } i = i + 1; }