GPS Program for Eco Car
Dependencies: MBed_Adafruit-GPS-Library SDFileSystem TextLCD mbed
Revision 0:d96c133bf9d2, committed 2015-03-24
- Comitter:
- mburns1
- Date:
- Tue Mar 24 18:20:06 2015 +0000
- Commit message:
- ver1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MBed_Adafruit-GPS-Library.lib Tue Mar 24 18:20:06 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mlee350/code/MBed_Adafruit-GPS-Library/#a23e3099bb0a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Tue Mar 24 18:20:06 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Tue Mar 24 18:20:06 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Mar 24 18:20:06 2015 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "SDFileSystem.h" +#include "stdio.h" +#include "string.h" + +DigitalOut myled(LED1); //initialize on board LED +DigitalIn toggle(p7); //initialize toggle switch +Serial GPS(p9, p10); //initialize gps board +Serial pc(USBTX, USBRX);//initialize serial pc connection +SDFileSystem sd(p11,p12,p13,p14,"sd"); //Initializes filesystem (DI, D0, CLK, CS) +int hasbeenopened = 1; +int haslooped = 0; + +int main() { + char cc; + toggle.mode(PullUp); + FILE *fp = fopen("/sd/gpsdata.txt", "a"); + while(1){ + while(toggle==1){ + if (hasbeenopened==0){ + FILE *fp = fopen("/sd/gpsdata.txt", "a"); + hasbeenopened=1; + } + myled=1; + cc = GPS.getc(); + fprintf(fp,"%c", cc); + haslooped=1; + } + myled=0; + if (haslooped==1){ + fclose(fp); + hasbeenopened=0; + haslooped=1; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Mar 24 18:20:06 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file