user3761: I have two successfully working individual programs,
1.GPS coordinate extract program.
2.EEPROM saving and reading program.
now all I want to do is combine them both, whenever GPS location is updated ,I want to save that latitude data to EEPROM memory repalcing the previously saved data, but I guess my program is unable to save it,its just showing blank spaces when reading EEPROM,please help me guys..here is my code.
#include <SoftwareSerial.h> 
#include <TinyGPS++.h>
#define RXPin 8
#define TXPin 9
#define GPSBaud 9600
#define ConsoleBaud 9600

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

// The TinyGPS++ object
TinyGPSPlus gps;
#include <EEPROM.h>
int address = 0; 
int read_value = 0; 
char data;
void setup()
{
  Serial.begin(ConsoleBaud);
  ss.begin(GPSBaud);
  Serial.println("Previous value stored :");
  for(address = 0; address < 25; address ++)        // read the entire EEPROM memory
  {  
    read_value = EEPROM.read(address);
    Serial.write(read_value);
  }
  Serial.println("\n");

}

void loop()
{

  while (ss.available() > 0)
    gps.encode(ss.read());

  if (gps.location.isUpdated() || gps.altitude.isUpdated())
  {
    Serial.print("Location: "); 
    Serial.print(gps.location.lat(), 6);
    Serial.print(",");
    Serial.print(gps.location.lng(), 6);
    Serial.println("\n");

    data=(gps.location.lat(), 6);

    for(address = 0; address < 25;  )
    {
      EEPROM.write(address, data); 
      address ++;
    }
  }
}


user1566: You might try using sprintf. First define a buffer:
char data[25];

Then use sprintf to print to the buffer:
sprintf(data, "Location: %.3f,%.3f\n", gps.location.lat(), gps.location.lon());

%.3f prints a float with 3 decimal places. Check out the printf reference for details.
Then write the buffer to EEPROM:
for(address = 0; address < 25; address++ )
{
  EEPROM.write(address, data);
}


user297: Consider TinyGPS++ over TinyGPS only if you are running on Due or processor which can take advantage of the higher precision of 64-bit “double” floating-point.
char data; should be double data;. You're wasting resources otherwise.
data=(gps.location.lat(), 6); isn't how you do it. You only need to specify precision when writing to Serial, like Serial.print(gps.location.lat(), 6);. Make it data = gps.location.lat();.
address ++; should be address = address <=512-sizeof(address) ? (address + sizeof(data)): 0 ;
address <=512-sizeof(address) ensures that the last value written to the EEPROM is written in it's entirety. 
Alternatively, I would recommend this to save you data structure directly to EEPROM, and what @jfpoilpret mentions.

3761: <p>I have two successfully working individual programs,
<strong>1.GPS coordinate extract program.</strong>
<strong>2.EEPROM saving and reading program.</strong>
now all I want to do is combine them both, whenever GPS location is updated ,I want to save that latitude data to EEPROM memory repalcing the previously saved data, but I guess my program is unable to save it,its just showing blank spaces when reading EEPROM,please help me guys..here is my code.</p>

<pre><code>#include &lt;SoftwareSerial.h&gt; 
#include &lt;TinyGPS++.h&gt;
#define RXPin 8
#define TXPin 9
#define GPSBaud 9600
#define ConsoleBaud 9600

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

// The TinyGPS++ object
TinyGPSPlus gps;
#include &lt;EEPROM.h&gt;
int address = 0; 
int read_value = 0; 
char data;
void setup()
{
  Serial.begin(ConsoleBaud);
  ss.begin(GPSBaud);
  Serial.println("Previous value stored :");
  for(address = 0; address &lt; 25; address ++)        // read the entire EEPROM memory
  {  
    read_value = EEPROM.read(address);
    Serial.write(read_value);
  }
  Serial.println("\n");

}

void loop()
{

  while (ss.available() &gt; 0)
    gps.encode(ss.read());

  if (gps.location.isUpdated() || gps.altitude.isUpdated())
  {
    Serial.print("Location: "); 
    Serial.print(gps.location.lat(), 6);
    Serial.print(",");
    Serial.print(gps.location.lng(), 6);
    Serial.println("\n");

    data=(gps.location.lat(), 6);

    for(address = 0; address &lt; 25;  )
    {
      EEPROM.write(address, data); 
      address ++;
    }
  }
}
</code></pre>
 1566: <p>You might try using <code>sprintf</code>. First define a buffer:</p>

<pre><code>char data[25];
</code></pre>

<p>Then use <code>sprintf</code> to print to the buffer:</p>

<pre><code>sprintf(data, "Location: %.3f,%.3f\n", gps.location.lat(), gps.location.lon());
</code></pre>

<p><code>%.3f</code> prints a float with 3 decimal places. Check out the <a href="http://www.cplusplus.com/reference/cstdio/printf/" rel="nofollow">printf</a> reference for details.</p>

<p>Then write the buffer to EEPROM:</p>

<pre><code>for(address = 0; address &lt; 25; address++ )
{
  EEPROM.write(address, data);
}
</code></pre>
 297: <p>Consider TinyGPS++ over TinyGPS only if you are running on Due or processor which can take advantage of the higher precision of 64-bit “double” floating-point.</p>

<p><code>char data;</code> should be <code>double data;</code>. You're wasting resources otherwise.</p>

<p><code>data=(gps.location.lat(), 6);</code> isn't how you do it. You only need to specify precision when writing to <code>Serial</code>, like <code>Serial.print(gps.location.lat(), 6);</code>. Make it <code>data = gps.location.lat();</code>.</p>

<p><code>address ++;</code> should be <code>address = address &lt;=512-sizeof(address) ? (address + sizeof(data)): 0 ;</code></p>

<p><code>address &lt;=512-sizeof(address)</code> ensures that the last value written to the <code>EEPROM</code> is written in it's entirety. </p>

<p>Alternatively, I would recommend <a href="http://playground.arduino.cc/Code/EEPROMWriteAnything" rel="nofollow">this</a> to save you data structure directly to <code>EEPROM</code>, and what @jfpoilpret mentions.</p>
