![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
gps
Dependencies: C12832_lcd FatFileSystemCpp GPS mbed MMA7660 PowerControl PwmIn
Fork of MSCUsbHost by
main.cpp
- Committer:
- AlexF64
- Date:
- 2014-05-09
- Revision:
- 4:071ff93721f8
- Parent:
- 0:e294af8d0e07
- Child:
- 6:9303188c8010
File content as of revision 4:071ff93721f8:
#include "mbed.h" #include "GPS.h" #include "C12832_lcd.h" #include "MSCFileSystem.h" #define FSNAME "msc" MSCFileSystem msc(FSNAME); Serial pc(USBTX, USBRX); GPS gps(p9, p10); C12832_LCD lcd; float timing; int main() { FILE *fp; fp = fopen( "/" FSNAME "/GPSData.txt", "w"); fprintf(fp,""); fclose(fp); while(1) { if(gps.sample()) { fp = fopen( "/" FSNAME "/GPSData.txt", "a"); fprintf(fp, "%.1f ",timing); //time when read fprintf(fp, "Longitude: %f ", gps.longitude); fprintf(fp, "Latitude: %f\n", gps.latitude); pc.printf("%f, %f\r\n",gps.latitude,gps.longitude); lcd.cls(); lcd.locate(3,3); lcd.printf("%.3f\n",gps.latitude);//print x to LCD at locate position lcd.locate(28,3);//move LCD location for y component lcd.printf("%.3f\n",gps.longitude);//print y to LCD to new locate position wait(0.5); fclose(fp); timing = timing + 0.5; } else { pc.printf("Oh Dear! No lock :(\r\n"); lcd.cls(); lcd.locate(3,3); lcd.printf("No GPS Lock"); } } }