Of course it does! But..
I have written a code using an ESP8266 microprocessor and it works fine. But because I need 2 additional pins I have upgraded to ESP32 (MH ET Live Mini). During the code upgrade all the peripherals worked well, but when loading the EEPROM sketch the ESP32 could not print and record more than one sprinf () chain at the same time.
I wrote this simple code for showing the problem:
#include <EEPROM.h>
#include <RTClib.h>
RTC_DS1307 rtc;
char Fecha[10];
char Hora[5];
void setup() {
Serial.begin(115200);
EEPROM.begin(32);
if (! rtc.begin()) {
Serial.println("Modulo RTC no encontrado !");
while (1);
}
DateTime Ahora = rtc.now();
sprintf(Fecha,"%02u/%02u/%04u ",Ahora.day(),Ahora.month(),Ahora.year());
sprintf(Hora,"%02u:%02u ",Ahora.hour(),Ahora.minute());
EEPROM.put(2, Fecha);
Serial.println(Fecha);
EEPROM.put(12, Hora);
Serial.println(Hora);
EEPROM.get(2, Fecha);
Serial.println(Fecha);
EEPROM.get(12, Hora);
Serial.println(Hora);
for (int k = 0; k <= 17; k++){
int valor = EEPROM.read(k);
Serial.print("Celda ");
Serial.print(k);
Serial.print(": ");
Serial.println(valor);
}
}
void loop() {
}
When sprintf(Date) is alone it works fine, but if it is added the sprintf(Time) does not print or record the first one. If a third sprintf() is added, the first two do not print or record, but the last one does. And so.
I tried another ESP32 chip and the result was the same. There is something that I am doing wrong but I do not achieve what it is. Hope someone can help me. Thank you