Bhoomi Bhanvadia
/
GPS_text
Revision 0:c8a89fd85220, committed 2011-03-02
- Comitter:
- bhoomi1810
- Date:
- Wed Mar 02 18:47:38 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r c8a89fd85220 GPS.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GPS.lib Wed Mar 02 18:47:38 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/keerthanasp/code/GPS/#c5d054086f2c
diff -r 000000000000 -r c8a89fd85220 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 02 18:47:38 2011 +0000 @@ -0,0 +1,60 @@ +#include "mbed.h" +#include <string.h> +#include "GPS.h" + +GPS gps(p9,p10); +Serial gsm(p28,p27); +Serial pc(USBTX,USBRX); + +int main() { + + gsm.baud(115200); + pc.baud(115200); + + char buf[40]; + char buf1[40]; + char buf2= 0x1A; + + gsm.printf("AT\r\n"); + gsm.scanf("%s",buf); + pc.printf("%s\n",buf); + gsm.scanf("%s",buf1); + pc.printf("%s\n",buf1); + + gsm.printf("AT+CSMP=17,167,0,0\r\n"); + gsm.scanf("%s",buf); + gsm.scanf("%s",buf1); + pc.printf("%s\n",buf); + pc.printf("%s\n",buf1); + + gsm.printf("AT+CMGF=1\r\n"); + gsm.scanf("%s",buf); + gsm.scanf("%s",buf1); + pc.printf("%s\n",buf); + pc.printf("%s\n",buf1); + + while (1) { + if (gps.sample()) { + //if (gps.latitude!=0.0 && gps.longitude!=0.0) { + pc.printf("message sent"); + gsm.printf("AT+CMGS=\"16782450426\"\r\n"); + gsm.scanf("%s",buf); + gsm.scanf("%s",buf1); + pc.printf("%s\n",buf); + pc.printf("%s\n",buf1); + + gsm.printf("latitude = %f longitude = %f %c\r\n",gps.latitude,gps.longitude,buf2); + gsm.scanf("%s",buf); + gsm.scanf("%s",buf1); + pc.printf("%s\n",buf); + pc.printf("%s\n",buf1); + + break; + } + pc.printf("LATITUDE = %f LONGITUDE = %f",gps.latitude,gps.longitude); + wait(1); + } + pc.printf("end of operation"); + + return 0; +} \ No newline at end of file
diff -r 000000000000 -r c8a89fd85220 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 02 18:47:38 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912