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