I am using the Arduino library. I would like to register some data from the sensor, date and time, in order to write it to the SD card.
To create a text file name, I tried
String dataFileName = String(String(sedClock.getTime().year(),DEC) + String(sedClock.getTime().month(),DEC) + String(sedClock.getTime().day(),DEC) + String(sedClock.getTime().hour(),DEC) + String(sedClock.getTime().minute(),DEC) + String(sedClock.getTime().second(),DEC) + '_log.txt');
Then I would like to enter this file using
pinMode(SD_PIN,OUTPUT); dataFile = SD.open(dataFileName,FILE_WRITE);
But I get
no matching function call to SDClass::open(String&, int) candidates are: File SDClass::open(const char*,uint_8)
But it seems that the Arduino string has no equivalent
(const char *) dataFileName.c_str()
So I canβt figure out how to do the right conversion
Any help would be greatly appreciated.
Caustic
source share