I try the code like below ,
it makes a directory if it is not present on the SD cart , but it would not write the file into this directory
can somebody help me with this?
if(SD_OK)
{
int y = year()-2000;
char dir[5];
char fileName[20];
int fileCounter=0;
sprintf(dir,"%04d",year()); //directory naam : 2013/
if (!SD.exists(dir))
{
SD.mkdir(dir);
}
do
{
fileCounter++;
sprintf(fileName,"%02d%02d%02d_%01d.csv",y,month(),day(),fileCounter);
}
while (SD.exists((dir,fileName)) && fileCounter<9); //if file in directory exist and counter<9 generate new name
logFile = SD.open((dir,fileName), O_CREAT | O_WRITE); //open file in directory