I've got a uBlox Neo 7N GPS Module and configured it so if theres is no incoming data print no location but if there is print the latitude and longitude. However it's printing ?,?.
So I'm assuming it's wired correctly as I'm getting an output however maybe my code is preventing it from printing the two long numbers hence converting it to a ? instead.
This is my function:
void displayInfo()
{
if (millis() - lastPublish >= PUBLISH_PERIOD) {
lastPublish = millis();
char buf[128];
delay(1000);
if (gps.location.isValid()) {
snprintf(buf, sizeof(buf), "%lf,%lf", gps.location.lat(), gps.location.lng());
Serial.println(buf);
}
else {
Serial.println("no location");
}
}
}
To clarifyEDIT I know these modules workthat Im getting a read as I've used themI set two variables of type double lat and long to get a location before around a month ago equal gps.location.lat(successfully), so I think I might have changed the code to something incorrect and gps.location.lng() respectively and I'm getting a number. How do I fix up this snprintf line so it prints properly?