Hi, I came across a problem on creating new files into SD card using SD library.
What I want to do is every time the device turns on it will create a new file with a unique name in the SD card. So I used Unix time as the name of the file. But it won't work, nothing will be created in the SD card and I think this may be caused by the length of Unix time which contains 10 numbers, such as 1559836353.csv.
If I use a number with only 8 numbers, such as 12345678.csv, then everything just works well.
Here is my code related to this problem.
#include <SD.h>
#include <DS3231.h>
File mySensorData;
static String filename;
void setup(){
pinMode(10, OUTPUT);
SD.begin(10);
rtc.begin();
filename = String(rtc.getUnixTime(rtc.getTime())) + ".csv";
// filename = "12345678.csv"; this line will work.
mySensorData = SD.open(filename, FILE_WRITE);
mySensorData.close();
}
void loop(){
// other functions
}
So I want to know if there is any solution to this problem or if there are some other methods to create a file with a unique name which only contains less than 8 characters.
Thanks a lot!