Go Down

Topic: GPS onto SD card not going well (Read 430 times) previous topic - next topic

My first post and I'm new to Arduino uno.
I have a Spakfun micro-SDcard shield, and a Sparkfun GPS shield. I have studied the references on sites that I feel I can trust and modified some the code which is attached.
My problems are as follows:
I finally was able to write to the SD card modifying a SD_sketch but I cannot get the card recognized or write on it when I combine the code into the tinyGPS code.

I have used the Arduino reference to make sure the correct pins are being used in the code for the Sparkfun-Shield.
At this point there are no errors listed.

When I use the tinyGPS sketch for a "simple-test" I get data that looks useful.
When I use the test_with_GPSdevice I get the generic read out but no real-time data.
My hope is someone who has been playing with these GPS& SD shields will recognize these issues and point me in the right direction.
My experience with code is ActionScript3.0 and a little bit of Processing.

Thanks

PaulS

The SD library uses 1/4 of the available memory on the UNO. The GPS library needs a fair amount. The String class wastes a lot, too.

Why are you declaring all the functions static? That makes sense only when there are multiple compilation units involved.

Your (long) string literals are consuming a lot of SRAM. The F() macro would stop that.
  Serial.print(F("Testing TinyGPS library v. "));

Ditch the String class. It is not needed. Writing to the SD file using one print() call or multiple print() calls takes the same amount of time, but the multiple write take far fewer resources.

Thanks for the suggestion.
I am not familiar with F() so it is always great to learn something new.
I placed it into the code
Code: [Select]
void loop()
{
 
  bool newdata = false;
  unsigned long start = millis();

  // Every second we print an update
  while (millis() - start < 1000)
  {
    if (feedgps())
      newdata = true;
      ///
       File dataFile = SD.open("LOG.csv", FILE_WRITE);
  if (dataFile)
  {
     Serial.print(F("testing TinyGPS library v. "));
  }
  else
  {
    Serial.println("Couldn't open log file");
  }

  }

Right now I am not able to get anything on to the SD card unless I declare the file as LOG.txt in which case I can write a previously stated String.
So the card is recognized.

I am trying to get the GPS info on to a LOG.csv file, which I created on the card.

Again, this is all pretty new to me so I am trying everything.

PaulS

The extension on the file should not matter. The SD class doesn't care what it is, as long as it's three characters or less.

I'd suggest moving the write to the card out of the while loop, and only writing when newdata is true.

Go Up