I need advice, I'm trying make code which is dividing data in to 37 MB files. The data comes from GPS.
I did code, when I turn on board it creates file and starts save in to SD card, I turn off and turn again on it creates new file and starts save data, that's ok, I deal with this. But I want make code which is saves files with volume 37 MB during saving process also, example: gpslog00, gpslog01 and so on. I think you got idea.
This is what I did in setup():
flag = 0;
// initialize a FAT16 volume
for(i=0; i<100; i++)
name = '0'+i/10;
name = '0'+i%10;
myFile.open(name, O_CREAT | O_APPEND | O_WRITE);
MsTimer2::set(450,stopGps);//Set Timer2 Interrupt every 900ms(at 8MHz)
and I couldn't figure out how make do dividing files during process of saving.
recv = Serial.read();
if(recv == 0x0A)
recvBuf = "";
recvBuf += recv;
nameIndex = recvBuf.indexOf(HeadMessage);
if(nameIndex != -1)//if there has HeadMessage there will not return -1,so we can know is ther a new message
recvBuf = "";
flag = 1;
if(flag == 1)
Gpsflag = 1;
myFile.print(HeadMessage);//wo miss the headmessage up there,so we add the head message before we add the next
while(Gpsflag)//Get one Packet message during the 900ms,cause the GPS send the message every 1 second
flag = 0;//clear the flag,waiting for the next Packet
myFile.close();//Close and Save
myFile.open(name,O_APPEND | O_WRITE);//allow to Write
Serial.flush();//Clrean the Serial Buff
Please help, I will be really appreciate!