Hello guys,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 ++;
}
}
}