mschramm:
Where to begin???
for (uint8_t i = 1; i < 100; i++) {
filename[6] = '0' + i/10;
filename[7] = '0' + i%10;
if(i==99){
g=1;
}
When this loop ends, the 7th and 8th characters in filename will both be 9, i will be 99 and g will be 1....every time you try to create a new file! I presume that's not what you want. I would keep a record of the last file number used and increment this every time you want to create a new filename. Something like this:
int i = 0; //put this before setup()
create new filename...
i++; //numbering starts at 01 and goes up to 99.
if(i==100){
g=1;
i = 0; // max exceeded, so reset counter
// warn max exceeded and file not created, here
}
else{
filename[6] = '0' + i/10;
filename[7] = '0' + i%10;
// create new file here
}