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!
Adafruit GPS Library
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit GPS Library
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:
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;
}
- mlomuscio
- Posts: 2
- Joined: Wed Feb 18, 2015 1:11 pm
Re: Adafruit GPS Library
Thanks! It all makes sense to me now!
Please be positive and constructive with your questions and comments.