#include #include // use functions to print strings from flash memory const uint8_t CHIP_SELECT = SS; // SD chip select pin. SdCard card; Fat16 file; long timeStamp; //char logName[]; char logName[] = "WRITE00.TXT"; char dataString [] = "testtest"; void setup(void) { Serial.begin(115200); Serial.println(); PgmPrintln("Type any character to start"); while (!Serial.available()); card.begin(CHIP_SELECT, SPI_FULL_SPEED); // initialize the SD card Fat16::init(&card); // initialize a FAT16 volume for (uint8_t i = 0; i < 100; i++) { logName[5] = i/10 + '0'; logName[6] = i%10 + '0'; // O_CREAT - create the file if it does not exist // O_EXCL - fail if the file exists // O_WRITE - open for write if (file.open(logName, O_CREAT | O_EXCL | O_WRITE)) break; } PgmPrint("Writing to: "); Serial.println(logName); Serial.println(); file.print(dataString); file.println(); timeStamp = micros(); } void loop(void) { file.print(timeStamp); file.println(); file.sync(); timeStamp = micros(); }