thanks for the advice... I found this example of the TinyGPS library and i would like to print my coordinates on the serial monitor for now. Later on i will adapt the code. i changed the RX and TX pins to 3 and 4 for my gps shield. The code compiles but displays this error:
avrdude: stk500_getsync(): not in sync: resp=0x00
I am new to Arduino... thanks in advance for your help
Example GPS Parser based off of arduiniana.org TinyGPS examples.
Parses NMEA sentences from an EM406 running at 4800bps into readable
values for latitude, longitude, elevation, date, time, course, and
For the SparkFun GPS Shield. Make sure the switch is set to DLINE.
Once you get your longitude and latitude you can paste your
coordinates from the terminal window into Google Maps. Here is the
link for SparkFun's location.
Uses the NewSoftSerial library for serial communication with your GPS,
so connect your GPS TX and RX pin to any digital pin on the Arduino,
just be sure to define which pins you are using on the Arduino to
communicate with the GPS module.
changed values to RXPIN = 2 and TXPIN = to correspond with
hardware v14+. Hardware v13 used RXPIN = 3 and TXPIN = 2.
// In order for this sketch to work, you will need to download
// NewSoftSerial and TinyGPS libraries from arduiniana.org and put them
// into the hardware->libraries folder in your ardiuno directory.
// Here are the lines of code that point to those libraries.
// Define which pins you will use on the Arduino to communicate with your
// GPS. In this case, the GPS module's TX pin will connect to the
// Arduino's RXPIN which is pin 3.
#define RXPIN 3
#define TXPIN 4
//Set this value equal to the baud rate of your GPS
#define GPSBAUD 4800
// Create an instance of the TinyGPS object
// Initialize the NewSoftSerial library to the pins you defined above
SoftwareSerial mySerial(RXPIN, TXPIN);
// This is where you declare prototypes for the functions that will be
// using the TinyGPS library.
void getgps(TinyGPS &gps);
// In the setup function, you need to initialize two serial ports; the
// standard hardware serial port (Serial()) to communicate with your
// terminal program an another serial port (NewSoftSerial()) for your
// This is the serial rate for your terminal program. It must be this
// fast because we need to print everything before a new sentence
// comes in. If you slow it down, the messages might not be valid and
// you will likely get checksum errors.
//Sets baud rate of your GPS
Serial.println("GPS Shield QuickStart Example Sketch v12");
Serial.println(" ...waiting for lock... ");
// This is the main loop of the code. All it does is check for data on
// the RX pin of the ardiuno, makes sure the data is valid NMEA sentences,
// then jumps to the getgps() function.
while(mySerial.available()) // While there is data on the RX pin...
int c = mySerial.read(); // load the data into a variable...
if(gps.encode(c)) // if there is a new valid sentence...
getgps(gps); // then grab the data.
// The getgps function will get and print the values we want.
void getgps(TinyGPS &gps)
// To get all of the data into varialbes that you can use in your code,
// all you need to do is define variables and query the object for the
// data. To see the complete list of functions see keywords.txt file in
// the TinyGPS and NewSoftSerial libs.
// Define the variables that will be used
float latitude, longitude;
// Then call this function
// You can now print variables latitude and longitude