Hi there. I'm stuck trying to figure out how to generate a different filename every day.
I came across this topic:
But I'm not sure how to apply that to my aim. I guess I need to work with char instead of strings...? Sorry I really lack some basic knowledge here and have been running in circles for ages now. Really hope someone could point me in the right direction.
Here is my code
I came across this topic:
But I'm not sure how to apply that to my aim. I guess I need to work with char instead of strings...? Sorry I really lack some basic knowledge here and have been running in circles for ages now. Really hope someone could point me in the right direction.
Here is my code
Code:
#include <SD.h>
#include <I2C_RTC.h>
static PCF8563 RTC;
const int chipSelect = BUILTIN_SDCARD;
String filenameDaily;
void setup() {
RTC.begin();
RTC.setDate(16, 05, 24); //SetDate(Day,Month,Year)
RTC.setTime(12, 14, 00); //SetTime(Hours,Minutes,Seconds)
int rtcDay = (RTC.getDay());
int rtcMonth = (RTC.getMonth());
int rtcYear = (RTC.getYear());
filenameDaily = String(rtcYear);
filenameDaily += String(rtcMonth);
filenameDaily += String(rtcDay);
filenameDaily += ".csv";
}
void loop() {
File dataFile = SD.open(filenameDaily, FILE_WRITE);
Serial.println(filenameDaily);
}