Gustavo Ramirez / Mbed 2 deprecated GPS_7

Dependencies:   GPS7 mbed

Fork of GPS_HelloWorld by Simon Ford

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "GPS.h"
00003 
00004 Serial pc(USBTX, USBRX);
00005 GPS gps(PTE22, PTE23);
00006 float frac_long, frac_lat;
00007 int main() {
00008     while(1) {
00009         if(gps.sample()) {
00010             pc.printf("longitud_entera=%d, Latitud entera=%d\n", (int)gps.longitude, (int)gps.latitude);
00011             frac_long=gps.longitude-(int)gps.longitude;
00012             pc.printf("Longitud Fraccionaria=%d\n", (int)abs(1000000*frac_long)); 
00013             frac_lat=gps.latitude-(int)gps.latitude;
00014             pc.printf("Latitud fraccionaria=%d\n", (int)abs(1000000*frac_lat)); 
00015         } else {
00016             
00017             pc.printf("Oh Dear! No lock :(\n");
00018         }
00019     }
00020 }