Thank you for sharing your problem with the Arduino community.
Could you please provide the following additional information so we can look into this issue properly?
Arduino IDE version
Operating system (Windows version)
The complete sketch that you uploaded
The Arduino board you are using
Some general checks:
Make sure you installed Arduino_MKRGPS library from Arduino IDE top menu > Sketch > Include Library > Manage Libraries: search for MKR_GPS and install.
Make sure the library is included at the beginning of the sketch: #include <Arduino_MKRGPS.h>
If after these check you keep having issues I recommend you contact Arduino Technical Support here
I bought an Arduino MKR Zero and want to run a MKR GPS device as a shield on top of the zero.
When I read the serial port without any library, I get the NMEA code.
It looks like there are missing some numbers but anyway I get a response from the GPS.
Example:
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() // run over and over
{
if (Serial1.available()>0)
{
Serial.write(Serial1.read());
}
}
To interpret the NMEA data I want to use the Arduino_MKRGPS.h library.
But if I try to use GPS.available(), GPS.altitude() oder any other function, there is nothing happening.
A simple code demonstration looks like this:
#include <Arduino_MKRGPS.h>
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
//Start connection to GPS
GPS.begin(GPS_MODE_UART);
}
void loop() // run over and over
{
// read GPS data
if (!GPS.begin()){
Serial.println("GPS Failed");
while(1);
}
if (!GPS.available()){
Serial.println("No data");
}
else
{
int satellites = GPS.satellites();
Serial.print("Number of Satellites:");
Serial.println(satellites);
}
}
Can anyone help me?
Could there be a problem in the library itself?
There is a common thread that there are issues with using the MKRGPS shield. My experience is thus:
MKR GSM 1400, all example sketches and additional code on Arduino site work.
MKRGPS, used as a shield, both example sketches work.
Put the 2 together, i.e. to send an SMS with the location from the GPS - mysteriously goes into a hole. Stops printing debug to Serial, claims to not acquire a location from the GPS.
I'll try the TinyGPS++ library instead as recommended above. I suspect bugs in the MKRGPS library and/or interactions with other serial-using libraries such as GSM.
Writing "everything is fine" is not helpful, IMHO.
instead of the MKRGPS. Just set the baud rate to 9600 and swap the SoftwareSerial references for Serial1 (the hardware serial port that the GPS communicates on when used as a shield).
instead of the MKRGPS. Just set the baud rate to 9600 and swap the SoftwareSerial references for Serial1 (the hardware serial port that the GPS communicates on when used as a shield).
I have tried this with the MKR GSM 1400 + MKR GPS Shield and only print 0s when trying to read position.
#include "TinyGPS++.h"
TinyGPSPlus gps;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
Serial1.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop() {
while (Serial1.available() > 0){
gps.encode(Serial1.read());
}
//if (GPS.altitude.isUpdated()){
Serial.println(gps.location.lat(), 6);
//}
delay(1000);
}
I'm having this issue as well. I tried the TinyGPS example, and I too am getting 0.0000. Has anyone found a solution? I'm using a MKR 1010 Board and the MKR GPS Shield connected via the I2C.