Name NMEA
Description Data connection to a GPS receiver. When you plan to use only the GPRMC routines from this library, connect with NMEA(GPRMC), all sentences that are not of type GPRMC are then ignored. To use more advanced routines of this library, connect with NMEA(ALL).
Syntax NMEA(GPRMC) or NMEA(ALL)
Parameters Connection type GPRMC or ALL
Returns void
Example code Connecting to GPRMC sentence type, Connecting to ALL sentence types
<< Back

Name decode
Description Decodes character received from the GPS. Returns 1 when the character completes a sentence, returns 0 otherwise. If the connection type is NMEA(ALL), every complete sentence is detected. If the connection type is NMEA(GPRMC), only sentences of type GPRMC are detected.
Syntax gps.decode(c)
Parameters
gpsGPS data connection
cchar
Returns int
Example code Basic positioning
<< Back

Name gprmc_status
Description Returns status character of the last GPRMC sentence received. The status character can be 'A' (for Active) or 'V' (for Void), and signals whether the GPS was active when the positioning was made. If it is void, the GPS could not make a good positioning and you should ignore it, which usually occurs when the GPS is still searching for satellites.
Syntax gps.gprmc_status()
Parameters
gpsGPS data connection
Returns char
Example code Basic positioning
<< Back

Name gprmc_utc
Description Returns UTC time of the last GPS positioning. Coordinated Universal Time (UTC) is independent of time-zones and daylight saving adjustments. It is commonly referred to as 'Greenwich Mean Time' (GMT) or 'Zulu' time. A floating-point value is returned which contains the hour, minutes, seconds and milliseconds. For example a value of 235219.281 indicates that the measurement was made at 23h52, 19 seconds and 281 milliseconds UTC.
Syntax gps.gprmc_utc()
Parameters
gpsGPS data connection
Returns float
Example code None
<< Back

Name gprmc_latitude
Description Returns latitude of GPS position. The latitude is returned as decimal degrees. A positive value indicates the Northern hemisphere, a negative value indicates the Southern hemisphere. For example, Sydney (Australia) is located around -33.853312 decimal degrees latitude, which is 33.853312 degrees latitude on the Southern hemisphere.
Syntax gps.gprmc_latitude()
Parameters
gpsGPS data connection
Returns float
Example code Basic positioning
<< Back

Name gprmc_longitude
Description Returns longitude of GPS position. The longitude is returned as decimal degrees. A positive value indicates East of Greenwich (UK), a negative value indicates West of Greenwich. For example, Sydney (Australia) is located around 151.209472 decimal degrees longitude, which is 151.209472 degrees East of Greenwich.
Syntax gps.gprmc_longitude()
Parameters
gpsGPS data connection
Returns float
Example code Basic positioning
<< Back

Name gprmc_speed
Description Returns speed-over-ground of GPS. To get the speed in kilometers-per-hour, use gprmc_speed(KMPH). Possible units of speed are KMPH for kilometers-per-hour, MPS for meters-per-second, MPH for miles-per-hour, and KTS for Knots.
Syntax gps.gprmc_speed(unit)
Parameters
gpsGPS data connection
unitKMPH, MPS, MPH, or KTS
Returns float
Example code Determining speed
<< Back

Name gprmc_course
Description Returns direction of movement in degrees. North is 0o, East is 90o, South is 180o, West is 270o. For example, if gprmc_course() returns 227.13, then you are moving roughly in South-West direction.
Syntax gps.gprmc_course()
Parameters
gpsGPS data connection
Returns float
Example code Determining course
<< Back

Name gprmc_distance_to
Description Returns distance of the GPS to a given position. For example, your distance in meters to the Dom Tower in Utrecht (Netherlands), is given by gprmc_distance_to(52.090647, 5.121283, MTR). As units of distance, you can use MTR for meters, KM for kilometers, MI for (international) miles, and NM for nautical miles.

Distance is calculated as 'great-circle distance' on a perfect sphere. It does not take into account terrain height variations, and Earth is no perfect sphere. As a result, calculated distance may be slightly off by an estimated maximum of 0.5%.
Syntax gps.gprmc_distance_to(latitude, longitude, unit)
Parameters
gpsGPS data connection
latitudefloat
longitudefloat
unitMTR, KM, MI, or NM
Returns float
Example code Determining distance
<< Back

Name gprmc_course_to
Description Returns direction (in degrees) from the GPS to a given position. North is 0o, East is 90o, South is 180o, West is 270o. For example, gprmc_course_to(48.858342, 2294522) returns the direction from your position to the Eiffel Tower in Paris (France). If this value is 319.01, then the Eiffel Tower is roughly North-West of you.

Note that the direction returned is independent of your own direction of movement. If you wish to navigate towards the Eiffel Tower, its direction relative to your own direction of movement is calculated as follows

float rel_dir = gps.gprmc_course_to(48.858342, 2294522) - gps.gprmc_course();
if (rel_dir < 0.0) {
  rel_dir += 360.0;
}
Course between positions is calculated over their connecting 'great-circle path' on a perfect sphere. It does not take into account terrain height variations, and Earth is no perfect sphere. As a result, calculated course may be off by a tiny fraction.
Syntax gps.gprmc_course_to(latitude, longitude)
Parameters
gpsGPS data connection
latitudefloat
longitudefloat
Returns float
Example code Determining course
<< Back

Name sentence
Description Returns the last sentence that was received. The sentence is returned as a zero-terminated sequence of characters. If the connection type is NMEA(ALL), all sentence types are received. If the connection type is NMEA(GPRMC), only sentences of type GPRMC are received.
Syntax gps.sentence()
Parameters
gpsGPS data connection
Returns char *
Example code Access all sentence types
<< Back

Name terms
Description Returns the number of terms in the last sentence that was received. This includes the datatype term, the checksum term, and possibly empty terms. For example, if the last sentence received was

$GPRMC,082804.683,A,5205.9421,N,00506.4368,E,0.02,146.61,190408,,*0C

then the number of terms is 13 (note the two empty terms just before the '*'). If the connection type is NMEA(ALL), all sentence types are received. If the connection type is NMEA(GPRMC), only sentences of type GPRMC are received.
Syntax gps.terms()
Parameters
gpsGPS data connection
Returns int
Example code Access all sentence types
<< Back

Name term
Description Returns a specific term from the last sentence that was received. The term is returned as a zero-terminated sequence of characters. For example, if the last sentence received was

$GPRMC,082804.683,A,5205.9421,N,00506.4368,E,0.02,146.61,190408,,*0C

then gps.term(7) returns "0.02". Note that the terms are numbered starting with zero. If the connection type is NMEA(ALL), all sentence types are received. If the connection type is NMEA(GPRMC), only sentences of type GPRMC are received.
Syntax gps.term(num)
Parameters
gpsGPS data connection
numint
Returns char *
Example code Access all sentence types
<< Back

Name term_decimal
Description Returns decimal value of a specific term from the last sentence that was received. For example, if the last sentence received was

$GPRMC,082804.683,A,5205.9421,N,00506.4368,E,0.02,146.61,190408,,*0C

then gps.term_decimal(1) returns floating-point value 82804.683. Note that the terms are numbered starting with zero. If the connection type is NMEA(ALL), all sentence types are received. If the connection type is NMEA(GPRMC), only sentences of type GPRMC are received.
Syntax gps.term_decimal(num)
Parameters
gpsGPS data connection
numint
Returns float
Example code None
<< Back

Name libversion
Description Returns the version number of the library. This may be useful to you, who knows...
Syntax gps.libversion()
Parameters
gpsGPS data connection
Returns int
Example code None
<< Back