My SAM-M8Q GPS module is having trouble displaying coordinates. When I run any code it says it is connected to GPS but only returns zeroes for latitude and longitude. It was working earlier in the week, so this issue has me pretty confused.
Here is an example of the code I am using:
Edited by moderator to add code tags
#include <Wire.h> //Needed for I2C to GPS
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_Ublox_GPS
SFE_UBLOX_GPS myGPS;
void setup()
{
Serial.begin(115200);
Serial.println("SparkFun Ublox Example");
Wire.begin();
if (myGPS.begin() == false)
{
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
while (1);
}
//This will pipe all NMEA sentences to the serial port so we can see them
myGPS.setNMEAOutputPort(Serial);
}
void loop()
{
//myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
float latitude = myGPS.getLatitude();
latitude = latitude / 10000000;
float longitude = myGPS.getLongitude();
longitude = longitude / 10000000;
Serial.println(latitude, 5);
Serial.println(longitude, 5);
delay(250); //Don't pound too hard on the I2C bus
}