Mkr nb 1500+mkr gps shield NOT WORK?

Hello, after consulting the forum, I cannot find an explanation why we cannot read the GPS with the examples supplied with the device. I have connected the mkr gps shield to the mkr nb 1500 board using I2C ports. I have run the following program...

#include <Arduino_MKRGPS.h>




void setup() {
   Serial.begin(9600);
   while (!Serial) {
    Serial.println("wait for GPS serial port to connect"); // wait for serial port to connect. Needed for native USB port only
  } 

  // If you are using the MKR GPS as shield, change the next line to pass
  // the GPS_MODE_SHIELD parameter to the GPS.begin(...)
  if (!GPS.begin()) {
    Serial.println("Failed to initialize GPS!");
    while (1);
  } else {Serial.println("Begin GPS ok");

  }
}

void loop() {
  // check if there is new GPS data available
 // check if there is new GPS data available
  do 
  {
    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(latitude, 7);
      Serial.print(" ");
      Serial.print(longitude, 7);
      Serial.print(" ");
      Serial.print(altitude);
      Serial.print(" ");
      Serial.print(speed);
      Serial.print(" ");
      Serial.print(satellites);
      Serial.print(" ");
    }

      }
  while(Wire.available());




  }

AND THE RESULT IS GPS.available() is always false....making it impossible to use the device...

1 Like

Try the steps below:

  1. Install the lastest IDE 2
  2. Download (zip) file and install this library GitHub - sparkfun/SparkFun_Ublox_Arduino_Library: Library to control UBX binary protocol and NMEA over I2C on Ublox GPS modules. Try many examples from this library, try those that check location or any data such as "Example3_GetPosition.ino"
    Remember that you need to first download the library from the link above and then import it into IDE 2 following Add libraries to Arduino IDE, restart the IDE and then go the IDE examples to for this library examples.
  3. Attach the recommended battery to the GPS shield before running the examples above and wait upto 20-30 minutes for it to connect.
1 Like

Thank you very much, solved. Read coordinates perfectly...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.