I have a having a hard time getting the date/time set when creating a file on a SD card on an 8266. I am using the SD.h and tried including sdfat.H but i keep getting an error ” ‘FAT_DATE’ was not declared in this scope”.
My code from the net:
void dateTime(uint16_t* date, uint16_t* time) { *date = FAT_DATE(year, month, day); *time = FAT_TIME(hour, minute, second); }
I included fatStructs and found a new error…………….
I cannot find a way to set the time an date on a file created on the SD card. Searched RNTlab and have found no answers. I would like to find the code to set date/time and then incorporate NTP or RTC time.
can you point me to a working set of code? Seems I need several libraries to make it work – missing something fundamental.
Hi Rick.
I’ve searched for that issue for a while and only found people with the same problem and without any answer.
The only thing I found was this library for Arduino:
https://github.com/greiman/SdFat and this example: https://github.com/greiman/SdFat/blob/master/examples/Timestamp/Timestamp.ino
I don’t know if it works with the ESP8266. I think this is what you are already using in your code, right?
Regards,
Sara
Yes on the SdFat or some version of it. I kept adding libraries until it got an error that was something like “not compatible with esp-8266” or close to those words.
I will look at timestamp.