Hi!
I am having trouble getting my SD code working.
#include <SD.h>
const int chipSelect = 4;
int logNr = 1;
int n = 0;
String fileName = "/Ard/LOG";
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("Card initialized.");
Serial.print("Checking directory...");
if (!SD.exists("/Ard")){
SD.mkdir("/Ard");
}
Serial.println("Done");
Serial.print("Setting up LOG file name...");
String file = fileName + String(logNr) + ".txt";
while(SD.exists(file)){
logNr++;
file = fileName + String(logNr) + ".txt";
}
fileName = file;
String msg = " Done (" + fileName ")";
Serial.println(msg);
}
SD_Log1.ino: In function 'void setup()':
SD_Log1:35: error: no matching function for call to 'SDClass::exists(String&)'
C:\Users\Michael Marne\Desktop\Arduino\arduino-1.0.5\libraries\SD/SD.h:77: note: candidates are: boolean SDClass::exists(char*)
SD_Log1:41: error: expected ',' or ';' before string constant
SD_Log1.ino: In function 'void loop()':
SD_Log1:54: error: no matching function for call to 'SDClass::open(String&, int)'
C:\Users\Michael Marne\Desktop\Arduino\arduino-1.0.5\libraries\SD/SD.h:74: note: candidates are: File SDClass::open(const char*, uint8_t)
I don't really know what to make of this error. What am I doing wrong?