I am trying to read GPS data from a UsGlobalSat BU-353 with NMEA format output using the following code and the GPS library.
- include "mbed.h"
- include "GPS.h"
Serial pc(USBTX, USBRX);
GPS gps(p9, p10);
int main() {
while(1) {
if(gps.sample()) {
pc.printf("The time is %i, and I'm at %f, %f\n", gps.time, gps.longitude, gps.latitude);
} else {
pc.printf("Oh Dear! No lock :(\n");
}
}
}
When I run the program, it calls the gps.sample() function, which in turn calls the gps.getline() function. However, when it gets to wait for the start of a line, the program stops. I checked what GPS data was coming in using gps.getc(), but it didn't show any data coming in. I know that there is data coming into the correct pin because I wrote a program to light an LED when there was data on that pin. Does anyone know why there doesn't appear to be any data coming in from the GPS?
I am trying to read GPS data from a UsGlobalSat BU-353 with NMEA format output using the following code and the GPS library.
Serial pc(USBTX, USBRX); GPS gps(p9, p10);
int main() { while(1) { if(gps.sample()) { pc.printf("The time is %i, and I'm at %f, %f\n", gps.time, gps.longitude, gps.latitude); } else { pc.printf("Oh Dear! No lock :(\n"); } } }
When I run the program, it calls the gps.sample() function, which in turn calls the gps.getline() function. However, when it gets to wait for the start of a line, the program stops. I checked what GPS data was coming in using gps.getc(), but it didn't show any data coming in. I know that there is data coming into the correct pin because I wrote a program to light an LED when there was data on that pin. Does anyone know why there doesn't appear to be any data coming in from the GPS?