Hi. First of all I am new to Arduino and not good at programming. I am using Arduino Yun and Adafruit Ultimate GPS Breakout. I need only the location co-ordinates for my project. I am using the leo_echo code from Adafruit_GPS library to get NMEA data. Here is the complete code.
// Test code for Adafruit GPS modules using MTK3329/MTK3339 driver
//
// This code just echos whatever is coming from the GPS unit to the
// serial monitor, handy for debugging!
//
// Tested and works great with the Adafruit Ultimate GPS module
// using MTK33x9 chipset
// ------> http://www.adafruit.com/products/746
// Pick one up today at the Adafruit electronics shop
// and help support open source hardware & software! -ada
//This code is intended for use with Arduino Leonardo and other ATmega32U4-based Arduinos
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
// Connect the GPS Power pin to 5V
// Connect the GPS Ground pin to ground
// If using software serial (sketch example default):
// Connect the GPS TX (transmit) pin to Digital 8
// Connect the GPS RX (receive) pin to Digital 7
// If using hardware serial:
// Connect the GPS TX (transmit) pin to Arduino RX1 (Digital 0)
// Connect the GPS RX (receive) pin to matching TX1 (Digital 1)
// If using software serial, keep these lines enabled
// (you can change the pin numbers to match your wiring):
SoftwareSerial mySerial(8, 7);
// If using hardware serial, comment
// out the above two lines and enable these two lines instead:
//HardwareSerial mySerial = Serial1;
#define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,1000*1F"
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C"
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F"
// turn on only the second sentence (GPRMC)
#define PMTK_SET_NMEA_OUTPUT_RMCONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"
// turn on GPRMC and GGA
#define PMTK_SET_NMEA_OUTPUT_RMCGGA "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28"
// turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28"
// turn off output
#define PMTK_SET_NMEA_OUTPUT_OFF "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28"
#define PMTK_Q_RELEASE "$PMTK605*31"
void setup() {
while (!Serial); // wait for leo to be ready
Serial.begin(57600); // this baud rate doesn't actually matter!
mySerial.begin(9600);
delay(2000);
Serial.println("Get version!");
mySerial.println(PMTK_Q_RELEASE);
// you can send various commands to get it started
//mySerial.println(PMTK_SET_NMEA_OUTPUT_RMCGGA);
mySerial.println(PMTK_SET_NMEA_OUTPUT_ALLDATA);
mySerial.println(PMTK_SET_NMEA_UPDATE_1HZ);
}
void loop() {
if (Serial.available()) {
char c = Serial.read();
Serial.write(c);
mySerial.write(c);
}
if (mySerial.available()) {
char c = mySerial.read();
Serial.write(c);
}
}
And I got the following output.
.......
$GPGGA,165231.096,,,,,0,03,,,M,,M,,*76
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,165231.096,V,,,,,0.60,130.91,070118,,,N*43
$GPVTG,130.91,T,,M,0.60,N,1.10,K,N*3E
$GPGGA,165233.000,,,,,0,03,,,M,,M,,*7B
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,165233.000,V,,,,,0.21,95.98,070118,,,N*7C
$GPVTG,95.98,T,,M,0.21,N,0.38,K,N*07
$GPGGA,165234.000,5313.8429,N,00031.3603,W,1,03,3.34,103.0,M,47.1,M,,*79
$GPGSA,A,2,24,12,15,,,,,,,,,,3.48,3.34,1.00*08
$GPGSV,1,1,04,15,63,181,40,24,61,272,32,12,22,208,40,13,,,36*4D
$GPRMC,165234.000,A,5313.8429,N,00031.3603,W,0.20,45.74,070118,,,A*43
$GPVTG,45.74,T,,M,0.20,N,0.37,K,A*09
$GPGGA,165235.000,5313.8433,N,00031.3606,W,1,03,3.34,103.0,M,47.1,M,,*76
$GPGSA,A,2,24,12,15,,,,,,,,,,3.48,3.34,1.00*08
$GPRMC,165235.000,A,5313.8433,N,00031.3606,W,0.16,72.89,070118,,,A*4F
$GPVTG,72.89,T,,M,0.16,N,0.29,K,A*05
$GPGGA,165236.000,5313.8439,N,00031.3609,W,1,03,3.34,103.0,M,47.1,M,,*70
$GPGSA,A,2,24,12,15,,,,,,,,,,3.48,3.34,1.00*08
$GPRMC,165236.000,A,5313.8439,N,00031.3609,W,0.22,44.58,070118,,,A*47
$GPVTG,44.58,T,,M,0.22,N,0.40,K,A*04
$GPGGA,165236.220,5313.8442,N,00031.3611,W,1,03,3.34,102.9,M,47.1,M,,*7D
$GPGSA,A,2,24,12,15,,,,,,,,,,3.48,3.34,1.00*08
$GPRMC,165236.220,A,5313.8442,N,00031.3611,W,0.22,59.75,070118,,,A*41
$GPVTG,59.75,T,,M,0.22,N,0.41,K,A*06
......
As you can see a lot of information are there. But for my project I need only the location co-ordinates and nothing else. Can somebody please help me to edit the code?