GPS parsing not working using gp20u7_adruino library.
Closed this issue · 4 comments
Hi , I am using this library for parsing GPS data but it's not working. I am using GP-20U7 GPS and Adruino M0. I waited around 5 mins after upload but still I couldn't see any data in sketch monitor. Any idea about this issue ?
Regards,
Suresh
Hey Suresh, thanks for using the library and reaching out. I don't have an M0 to test on but I found the following in the M0 docs.
Note that on the M0, the SerialUSB class refers to USB (CDC) communication; for serial on pins 0 and 1, use the Serial5 class.
If you are using the example code there is the following line:
GP20U7 gps = GP20U7(Serial);
Did you try changing that line to be:
GP20U7 gps = GP20U7(Serial5);
Below is updated code I am trying on Arduino M0. Just in additional basically I am using Sodaq Explorer board but this board is made on Arduino M0 platform only with some additional feature.
#include <gp20u7.h>
// initialize the library with the serial port to which the device is
// connected
GP20U7 gps = GP20U7(Serial);
// Set up a Geolocation variable to track your current Location
Geolocation currentLocation;
void setup() {
// Start the GPS module
gps.begin();
}
void loop() {
// The call to read() checks for new location information and returns 1
// if new data is available and 0 if it isn't. It should be called
// repeatedly.
if(gps.read()){
currentLocation = gps.getGeolocation();
SerialUSB.println("Your current location is:");
SerialUSB.print(" Latitude: ");
SerialUSB.println(currentLocation.latitude,5);
SerialUSB.print(" Longitude: ");
SerialUSB.println(currentLocation.longitude,5);
}
}
Hi Thanks same code worked now. I don't remember what I did before but it worked now. Thanks really good library and very simple code to understand and use.