SkyNav SKM53 GPS

i want to modify this code to show lon,lat direct to send it by gsm
the output
Latitude : 0.0000000 :: Longitude : 0.0000000
Latitude : 0.0000000 :: Longitude : 0.0000000
i want to show lat,lon , if lat,lon have value only.

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


unsigned long fix_age;

SoftwareSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
  GPS.begin(9600);
  Serial.begin(115200);
}

void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;

  // retrieves +/- lat/long in 100000ths of a degree
  gps.get_position(&lat, &lon, &fix_age);

  getGPS();

  Serial.print("Latitude : ");
  Serial.print(LAT/1000000,7);
  Serial.print(" :: Longitude : ");
  Serial.println(LON/1000000,7);
  
  
}

void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  // Every 1 seconds we print an update
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}

bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}

void gpsdump(TinyGPS &gps)
{
  //byte month, day, hour, minute, second, hundredths;
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors
  }
}
  Serial.print("Latitude : ");
  Serial.print(LAT/1000000,7);
  Serial.print(" :: Longitude : ");
  Serial.println(LON/1000000,7);

You seem to be printing the LAT and LON variables but never changing their values.

Latitude : 29.9746150 :: Longitude : 31.2454032
Latitude : 29.9746150 :: Longitude : 31.2454032
Latitude : 29.9746150 :: Longitude : 31.2454032
Latitude : 29.9746150 :: Longitude : 31.2454032

the output now
I want to modify the code , if there's no change in values, the code don't print values,and waiting to new value..

My apologies. I can see where LAT and LON are updated.

Floats are notoriously difficult to compare because of how they are stored and calculated. How much of a change in value constitutes “no change in value”. Working to that many decimal places with floats is likely to result in a slightly different reading each time.

UKHeliBob:
My apologies. I can see where LAT and LON are updated.

Floats are notoriously difficult to compare because of how they are stored and calculated. How much of a change in value constitutes "no change in value". Working to that many decimal places with floats is likely to result in a slightly different reading each time.

in the first of serial monitor,output
Latitude : 0.0000000 :: Longitude : 0.0000000
Latitude : 0.0000000 :: Longitude : 0.0000000
Latitude : 0.0000000 :: Longitude : 0.0000000
Latitude : 0.0000000 :: Longitude : 0.0000000
Latitude : 0.0000000 :: Longitude : 0.0000000
Latitude : 0.0000000 :: Longitude : 0.0000000
then
the right location

That is because it takes a while for the GPS device to start working, it has to download information from the satellites first.

As an experiment, after you print LAT and LON save LAT/10000 and LON/10000 in 2 new variables. Before you print them again test the new values of LAT/10000 and LON/10000 against the previous ones and only print if either of them has changed.