I want to use the MKR GPS module as a shield (not I2C) on the MKR WAN 1310. Unfortunately, the code below goes wrong. Even after a very long wait I do not receive any GPS messages.
Does anyone know what I'm doing wrong?
#include <Arduino_MKRGPS.h>
int i;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
}
if (!GPS.begin(GPS_MODE_SHIELD)) {
Serial.println("Failed to initialize GPS!");
while (1);
}
else Serial.println("GPS Ready");
}
void loop() {
// check if there is new GPS data available
if (GPS.available()) {
// read GPS values
float latitude = GPS.latitude();
float longitude = GPS.longitude();
float altitude = GPS.altitude();
float speed = GPS.speed();
int satellites = GPS.satellites();
// print GPS values
Serial.print("Location: ");
Serial.print(latitude, 7);
Serial.print(", ");
Serial.println(longitude, 7);
Serial.print("Altitude: ");
Serial.print(altitude);
Serial.println("m");
Serial.print("Ground speed: ");
Serial.print(speed);
Serial.println(" km/h");
Serial.print("Number of satellites: ");
Serial.println(satellites);
Serial.println();
}
else {
i++;
Serial.print("Waiting now ");
Serial.print(i);
Serial.println(" seconds");
delay(1000);
}
}