GPS inerface with Arduino

can anybody tell me how to find longitude and latitude value from GPS modem that are connected to Arduino UNO

I connected GPS Rx to Arduino RX, Tx to Tx , GND to GND and give power supply

But get different output...

My code is:-

#include <SoftwareSerial.h>
#include "TinyGPS.h"

long lat,lon; // create variable for latitude and longitude object
SoftwareSerial gpsSerial(2, 3);
TinyGPS gps; // create gps object

void setup(){
Serial.begin(9600); // connect serial
gpsSerial.begin(9600); // connect gps sensor
}
void loop(){
while(gpsSerial.available()){ // check for gps data
if(gps.encode(gpsSerial.read())){ // encode gps data
gps.get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("lat: ");Serial.print(lat);Serial.print(" ");// print latitude
Serial.print("lon: ");Serial.println(lon); // print longitude
}
}
}

please help me

I connected GPS Rx to Arduino RX, Tx to Tx , GND to GND and give power supply

But, you aren't reading the GPS data from the TX and RX pins, so why did you connect the GPS there?

So what to do?

i want take GPS data and store it to Arduino and then GSm will send the SMS to mobile...

My GSM work is done...GSM is sending SMS

SoftwareSerial gpsSerial(2, 3);

That's on the hardware serial pins is it? Because that's where you have connected the GPS it seems.


Rob

Here is a working gps example:
stuffing gps data into variables - Arduino Your Home & Environment: Arduino & uBlox Neo 6M GPS

Rx goes to Tx and Tx goes to Rx one sends one receives.

The fiset thing to do with the gps is to read from the gps (one byte at a time) and write it to serial. This tinygps etc does not allow you to check that you are getting a valid fix and therefore a sane result.

Mark