Libraries \ NMEA

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Class

NMEA

Name

gprmc_latitude()

Examples
#include <nmea.h>

// create a GPS data connection to GPRMC sentence type
NMEA gps(GPRMC);

void setup() {
  Serial1.begin(4800);
  pinMode(8, OUTPUT);
}

void loop() {
  if (Serial1.available() > 0 ) {
    // read incoming character from GPS
    char c = Serial1.read();

    // check if the character completes a valid GPS sentence
    if (gps.decode(c)) {
      // check if GPS positioning was active
      if (gps.gprmc_status() == 'A') {
        // check if you are in Colorado, USA
        boolean inColorado = (gps.gprmc_latitude() > 37.0)
                          && (gps.gprmc_latitude() < 41.0)
                          && (gps.gprmc_longitude() < -102.05)
                          && (gps.gprmc_longitude() > -109.05);

        // set led accordingly
        if (inColorado) {
          digitalWrite(8, HIGH);
        } else {
          digitalWrite(8, LOW);
        }
      }
    }
  }
}
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
gprmc_latitude()
Returns float
Usage Application
Updated on July 07, 2011 11:11:10pm PDT

Creative Commons License