SRAM overflow

uau! thanks a lot for the replies!

MarkT:
Perhaps 8 bit resolution is OK - use byte val = (byte) (analogRead() >> 2) and all arrays can then be byte arrays?

yes, this is the way. And have to store them (at eeprom or flash?) in order to load calibration pattern when restarting.

liudr:
Seems to me the maxval and minval are filled in setup and their values don't change for the duration of the program. If this is the case, then store them in EEPROM. There is 1KB of EEPROM on arduino, which is exactly how much you need to store maxval and minval both.

yes, I agree. In fact, due practical uses, I'm changing the code to calibrate in another way (with known times that every sensor will be tested). But I still want to solve this.

And the solution seems to come again with malloc().

At this moment I followed instructions from:

but I'm still trying to make the correct modifications (I'm a newbie :wink:

Thank you a lot guys, I'm learning a lot these weeks!

best regards,

toni