GPS Logger giving the wrong location????

I just got my gps logger up and running but I am having some problems. I am using a pharos-gps500 sirf3 module , duemilanove, and an sd shield from seeestudio.

I first tried the tinygps example sketch testwithgps. I entered the data it output to the serial monitor into google maps and it was dead on for my location.

So I know the gps module works. Now that I have it all put together and running some different code and logging to the sd card the lat and lon its recording are way off. Sitting on my patio I let it run for about 40 minutes to be sure it had a lock.

When I entered the coordinates it puts out into googlemaps it shows up about 11 miles from where I actually collected the data.

here is my code Im running, perhaps its a mistake in the code?


So it outputs a text file with a heading and the data that looks something like this:

year,month,day,hour,minute,seconds,latitude,longitude,altitude(ft),speed(mph),course

2011,10,18,16,52,35,33.8121,-117.91893,140,0.1,44.1

2011,10,18,16,53,35,33.8119,-117.91874,141,2.1,88.3

*/

//Add the Mikal Hart Libraries

#include <SoftwareSerial.h>

#include <TinyGPS.h>

//Add the SdFat Libraries

#include <SdFat.h>

#include <SdFatUtil.h>

#include <ctype.h>

//Create the variables to be used by SdFat Library

Sd2Card card;

SdVolume volume;

SdFile root;

SdFile file;

#define BUFFSIZE 65

char buffer[BUFFSIZE]; //This will be a data buffer for writing contents to the file.

char in_char=0;

char filename=“trip.txt”;

//Intialize TinyGPS and SoftwareSerial

TinyGPS gps;

SoftwareSerial nss(3, 2);

//Intialize GPS variables

long lat, lon;

float flat, flon, fspeed, falt, fcourse;

unsigned long age, date, time, chars;

int year;

byte month, day, hour, minute, second, hundredths;

unsigned short sentences, failed;

bool newdata = false;

bool feedgps();

void setup()

{

nss.begin(4800); //GPS’s Buad Rate

pinMode(0, INPUT);

pinMode(1, OUTPUT);

pinMode(10, OUTPUT);

pinMode(13, OUTPUT); //LED Pin

digitalWrite(13, LOW); // Ensure LED starts as off

card.init(); //Initialize the SD card and configure the I/O pins.

volume.init(card); //Initialize a volume on the SD card.

root.openRoot(volume); //Open the root directory in the volume.

//Create file with defined filename

file.open(root, filename, O_CREAT | O_APPEND | O_WRITE); //Open or create the file ‘name’ in ‘root’ for writing to the end of the file

file.print(“year,month,day,hour,minute,seconds,latitude,longitude,altitude(ft),speed(mph),course\n”); //Write the header array to the end of the file.

file.close(); //Close the file.

// flash LED 5 times when setup is finished

for (int i=0; i<4; i++){

digitalWrite(13, HIGH); // set the LED on

delay(1000); // wait for a second

digitalWrite(13, LOW); // set the LED off

}

}

void loop()

{

bool newdata = false; // check if data is coming in

if (feedgps())

newdata = true;

if (newdata)

{

//Pull gps data

gps.f_get_position(&flat, &flon, &age);

feedgps(); //used to keep gps “awake”

gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);

feedgps();

falt = gps.f_altitude();

fspeed = gps.f_speed_mph();

fcourse = gps.f_course();

feedgps();

//Break up float values into whole numbers(var) and decimals(var1) to be added to data

int flat1 = (flat - (int)flat) * 10000;

int flon1 = (flon - (int)flon) * 100000;

int alt1 = 0;

if (falt >= 10000000.00){ //when gps cant get altitude

falt = 0; //set to 0

}else{

falt = falt * 0.032808399; //cm to feet

alt1 = (falt - (int)falt) * 10;

}

int fspeed1 = (fspeed - (int)fspeed) * 10;

int fcourse1 = (fcourse - (int)fcourse) * 10;

//Create then write the char array “buffer” to the end of the file

file.open(root, filename, O_WRITE | O_APPEND); //Open the file in write mode and append the data to the end of the file.

sprintf(buffer, “%d,%d,%d,%d,%d,%d,%0d.%d,%0d.%d,%0d.%d,%0d.%d,%0d.%d\n”, year,month,day,hour,minute,second,(int)flat,abs(flat1),(int)flon,abs(flon1),(int)falt,abs(alt1),(int)fspeed,abs(fspeed1),(int)fcourse,abs(fcourse1));

file.print(buffer); //Write the ‘contents’ array to the end of the file.

file.close(); //Close the file

//flash LED

digitalWrite(13, HIGH); // set the LED on

delay(500);

digitalWrite(13, LOW); // set the LED off

delay(10000); // wait 10 sec before writing next data point

}

}

bool feedgps()

{

while (nss.available())

{

if (gps.encode(nss.read()))

return true;

}

return false;

}

Here is an example I drove to a carwash and plugged in my logger and got these coordinates:40.6186,-122.26272

But the coordinates for that location according to :http://www.whatsmygps.com/

are :40.618733 - -122.392658

Perhaps this is a DD.ddd versus DD.MMmm versus DD.MMSSss issue when entering data into Google?