I would appreciate the community's help with the EEPROM issue I am having.
I am storing in EEPROM 33 String values. Each value is a String that is a maximum of 25 bytes. Given that the EEPROM for the Teensy 4.1 is 4284 bytes, I should have more than enough space.
However, using the code below, I can write a maximum of 29 values. After that, nothing is written to the EEPROM. What is causing this problem?
I am storing in EEPROM 33 String values. Each value is a String that is a maximum of 25 bytes. Given that the EEPROM for the Teensy 4.1 is 4284 bytes, I should have more than enough space.
However, using the code below, I can write a maximum of 29 values. After that, nothing is written to the EEPROM. What is causing this problem?
Code:
void fillEEPROM()
{
String myStr[33];
myStr[0] = "1";
myStr[1] = "300";
myStr[2] = "168";
myStr[3] = "10";
...
...
for (int i = 0; i < 33; i++)
{
writeStringToEEPROM((25 * i), myStr[i].trim());
}
}
void writeStringToEEPROM(int addrOffset, const String &strToWrite)
{
byte len = strToWrite.length();
EEPROM.write(addrOffset, len);
for (int i = 0; i < len; i++)
{
EEPROM.write(addrOffset + i, strToWrite[i]);
}
}