I have been working on a Bluetooth serial buffer and finally got it working. When I send the text "ep100" it saves 100 to the Variable[29]. Now to the problem. When I set Variable[29] to 100 and then call this function below, it only allows me to save the eeprom 4 times and then it doesn't let me do it anymore. When I set Variable[32] to 100 it loads the EEPROM values. This works every time without fail. Does anyone know why I can't save data more than 4 times? The "int Variable[VarNum];" is declared outside the Setup() and Loop().
Thanks guys.
#define VarNum 33
int Variable[VarNum];
void loadEEPROM() {
if ( Variable[32] == 100) {
for (int i = 0; i < VarNum; i++) {
Variable[i] = EEPROM.read(i);
}
EEPROM.update(32, 0);
Variable[32] = 0;
}
if (Variable[29] == 100) {
Variable[29] = 0;
for (int i = 0; i < VarNum; i++) {
EEPROM.update(i, Variable[i]);
}
}
}