void SETLEDSFROMWEBUI_TO_EEPROM(){
EEPROM.write(13, 0x92); //position 14 to 589 // LEDS 96 * 6LEDS
int i=1;
int y=14;
for (y = 14 ; y <= (LEDVALUES+13); y++ ){
EEPROM.write(y, LED1[i]);
EEPROM.write(y+(LEDVALUES), LED2[i]);
EEPROM.write(y+(LEDVALUES*2), LED3[i]);
EEPROM.write(y+(LEDVALUES*3), LED4[i]);
EEPROM.write(y+(LEDVALUES*4), LED5[i]);
EEPROM.write(y+(LEDVALUES*5), LED6[i]);
i++;
wdt_reset();
}
}
i need this code in order to take all the values from 6 byte arrays of 96 values each , and set them into the epprom ,
after the execution of this code , i read my ram with
int freeRam () {
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
You can't. That piece of code is allocating 2 int's (i.e., 4 bytes) - y and i - on the stack. The 700 bytes probably comes from the LED arrays. If they are byte arrays they total 576 bytes. If they're int arrays then you're wasting an extra 576 bytes.
That function returns the amount of free RAM between the top of the heap and the bottom of the stack. It doesn't take into account any free space within the heap itself.
as you can see i play with String all the time ...
i store into a temp array the values , and then i send them into the selected led array , after that i store them into the EPPROM
getWELED2values(parm);
for (int i = 1 ; i <=LEDVALUES; i++)
{
wdt_reset();
SETLedValue(selectedLED, i, WebSelectedLEDvalues[i]);
}
SETLEDSFROMWEBUI_TO_EEPROM();
Parse the data as it comes in - don't store it in an intermediate array.
You might also be better only sending values that have been changed rather than the whole lot, or breaking the data down into separate chunks and sending them as separate requests. If you identify the variables with numbers instead of just a generic "PWM=..." (i.e., use "PWM1=...&PWM2=..." etc) then you can tie that to an array slice. Also, keeping your parameter names short would save space - use P1 instead of PWM1 for example. HEX encoding can also reduce space in the data stream, since FF is one character less than 255 (tip: strtol() can parse HEX values).