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:
- 4:db6f9f91a04b
- Parent:
- 3:05d2d090b8b0
- Child:
- 5:651dc38cc1a6
--- a/main.cpp Wed May 07 10:22:15 2014 +0000 +++ b/main.cpp Wed May 07 10:27:35 2014 +0000 @@ -3,6 +3,7 @@ #include "MMA7660.h" #include "CMPS03.h" #include "MSCFileSystem.h" +#include "C12832_lcd.h" #define FSNAME "USB" @@ -11,6 +12,7 @@ GPS gps(p9, p10); // GPS connections MMA7660 MMA(p28, p27); // Accelerometer connections CMPS03 compass(p28, p27, CMPS03_DEFAULT_I2C_ADDRESS); // Compass connections +C12832_LCD lcd; // Declarations float ax, ay, az; // acceleration values @@ -67,9 +69,9 @@ pc.printf("The reference bearing: %f\n\n", refPoint/10); while(i == 1) { - FILE *CompassFile = fopen("/" FSNAME "/compass_file.txt", "a"); - FILE *GPSFile = fopen("/" FSNAME "/gps_file.txt", "a"); - FILE *AccelFile = fopen("/" FSNAME "/accel_file.txt", "a"); + CompassFile = fopen("/" FSNAME "/compass_file.txt", "a"); + GPSFile = fopen("/" FSNAME "/gps_file.txt", "a"); + AccelFile = fopen("/" FSNAME "/accel_file.txt", "a"); // GPS code if(gps.sample()) { @@ -79,7 +81,7 @@ } else { - fprintf(GPSFIle, "\nNo lock!\r\n"); + fprintf(GPSFile, "\nNo lock!\r\n"); lcd.locate(1,1); lcd.printf("GPS: No lock!"); }