CODE: SELECT ALL long start_time_spiffs = millis();
File configFile = SPIFFS.open("/lights.conf", "w+");
if (!configFile)
{
Serial.println(F("Failed to open test.conf"));
} else {
Serial.println(F("Opened Hue_conf.txt for UPDATE...."));
Serial.printf("Start Position =%u \n", configFile.position());
unsigned char * data = reinterpret_cast<unsigned char*>(Lights); // use unsigned char, as uint8_t is not guarunteed to be same width as char...
size_t bytes = configFile.write(data, sizeof(HueLight) * _LightCount ); // C++ way
Serial.printf("END Position =%u \n", configFile.position());
configFile.close();
}
write a struct array to spiffs was last modified: June 29th, 2022 by