Adafruit GPS Library

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mlomuscio
 
Posts: 2
Joined: Wed Feb 18, 2015 1:11 pm

Adafruit GPS Library

Post by mlomuscio »

Hello Everyone,

I teach a STEAM course at an international boarding school. I have a student using the FLORA GPS module. However, I'm having some trouble understanding the Adafruit GPS Library. I've looked on the Gethub site and I don't see much documentation about the library.

Specifically my issue is with the command "GPS.latitude". This command appears to concatenate the degrees and minutes of the latitude and then add the seconds as a decimal (converted to base 10). Why are the degrees and minutes concatenated? What does this number represent?

Any advice would be appreciated! Thanks!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adafruit GPS Library

Post by adafruit_support_rick »

Latitude and longitude both have the same format: (degrees*100) + minutes.
That is the format as received from the GPS itself.

Here's a function to convert the format to decimal degrees:

Code: Select all

float ToDecimalDegrees(float formattedLatLon)
{
  float decDegrees = (float)((int)formattedLatLon / 100);
  float decMinutes = formattedLatLon - (decDegrees * 100);
  float fractDegrees = decMinutes / 60.0;
  
  return decDegrees + fractDegrees;
}

User avatar
mlomuscio
 
Posts: 2
Joined: Wed Feb 18, 2015 1:11 pm

Re: Adafruit GPS Library

Post by mlomuscio »

Thanks! It all makes sense to me now!

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”