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:
- 5:651dc38cc1a6
- Parent:
- 4:db6f9f91a04b
- Child:
- 6:c667497a588d
diff -r db6f9f91a04b -r 651dc38cc1a6 main.cpp --- a/main.cpp Wed May 07 10:27:35 2014 +0000 +++ b/main.cpp Wed May 07 10:34:03 2014 +0000 @@ -66,7 +66,9 @@ while (1) { refPoint = compass.readBearing(); - pc.printf("The reference bearing: %f\n\n", refPoint/10); + lcd.locate(1,1); + lcd.printf("Ref bearing: %.2f", refPoint/10); + //pc.printf("The reference bearing: %f\n\n", refPoint/10); while(i == 1) { CompassFile = fopen("/" FSNAME "/compass_file.txt", "a"); @@ -76,13 +78,13 @@ if(gps.sample()) { fprintf(GPSFile, "\n%f %f\r\n", gps.latitude, gps.longitude); - lcd.locate(1,1); + lcd.locate(1,11); lcd.printf("GPS: %.4f %.4f", gps.latitude, gps.longitude); } else { fprintf(GPSFile, "\nNo lock!\r\n"); - lcd.locate(1,1); + lcd.locate(1,11); lcd.printf("GPS: No lock!"); } @@ -92,7 +94,7 @@ ay=MMA.y(); az=MMA.z(); fprintf(AccelFile, "%f %f %f\r\n",ax,ay,az); - lcd.locate(1,11); + lcd.locate(1,21); lcd.printf("MMA: %.4f %.4f %.4f",ax,ay,az); // Compass code @@ -101,7 +103,7 @@ { bearing = 360 + bearing; fprintf(CompassFile, "Bearing : %f\r\n", bearing); - lcd.locate(1,21); + lcd.locate(1,31); lcd.printf("CMP: %.2f",bearing); } else