I'm trying to datalog to a EyeFi SD card by writing to a file with a jpg extension. Here's that portion of my code so far:
// see if the directory exists, create it if not.
if( !SD.exists("/DCIM/100NIKON") )
{
if( SD.mkdir("/DCIM/100NIKON") )
{
Serial.print("File directory created: ");
}
else {
error("File directory not created");
}
}
else
{
Serial.print("File directory exists: ");
}
// Test file
char filename[] = "DSCN0000.JPG";
if (! SD.exists(filename))
{
logfile = SD.open(filename, FILE_WRITE); // only open a new file if it doesn't exist
}
if (! logfile)
{
error("Couldnt create file");
}
The Arduino creates the directory, but the file is still saved to the root. I would love some help or tips on this.