Keep values stored after Poweroff.

Hello,

I Need a simple Setup:

  • Analog Input 0-5V A1
  • Hardware Switch S1
  • Digital Output D1
  • Digital Output D2

When S1 is closed I want to read the values of A1 and store the highest and lowest value during S1 is closed. Lets say I measured 1,2V and 3,6V.

When S1 is open I want to read A1 and when A1 reaches 1,2V I want the D1 to be HIGH. When A1 reaches 3,6V I want D2 to be HIGH.

This is all simple and I have no any questions about this. My question is: how can I store the measured values 1,2V and 3,6V in a way, they stay in Memory even if there was no power to arduino for a while?

With external memory!

You can use the internal EEPROM if it's only those values. Just keep in mind there are a limited number of write cycles so you want to only update the memory when the values change, not every time through your loop.

Yes,

this was my question if that works. It´s simply two values and the Change of this value will be done maybe 100 times in total life of the board (I would guess if it´s ready, this is done Maximum 10 times).

Is there any sketches showing the EEPROM read/write for example on a Nano board?