Flash memory

I have no experience of using flash memory!

In my project of a greenhouse controller it is necessary to set-up the controller on startup with preferred values. If for some reason the power supply fails, these values are lost and the controller has to be setup all over again which can be a big problem as values are sometimes developed over an extended period.

So, what about using flash memory to store these values? Pointers please.

So, what about using flash memory to store these values?

Flash memory is read-only at run time.

EEPROM is writable. Unless you have a Due, which doesn't have EEPROM.

You can but it will become tricky if you want to change them.

How about storing in EEPROM?

Are you confusing flash memory with EEPROM? EEPROM is usually where those type of values would be stored. The EEPROM library that comes with the IDE has example code.

If you do have a Due, there are many I2C or SPI EEPROMs available.

I have no experience in the use of memory. It will be necessary for the stored data to be editable while the controller is running and for it to be retained if the power supply fails. I don't know what type the memory should be, and I only have the faintest knowledge of using EEPROM.

I would prefer to use a Nano.

Thanks groundFungus - I was not quite aware that a Nano would have its own EEPROM. I'm off in that direction now!

https://www.arduino.cc/en/Reference/EEPROM

EEPROM is easy to use and the values that you want to keep can be easily changed and written to the EEPROM when the sketch is running. Be aware that the EEPROM has a limit to the number of writes (not so with read).

To add to what groundFungus said, do NOT perform continuous updates to EEPROM in loop.

I update variables stored in EEPROM with some simple Serial commands, either thru the hyperterminal or through another program I built in VB.net on my PC.

Ed

The data in EEPROM will only be amended until all the components are operating satisfactory, this will likely be soon after startup but I am grateful for the warning of write limits. How many times? I'm not expecting thousands but I'll have to remember the Nano I use for bread-boarding could be limited if I use it in a circuit afterwards.

In the circumstance where a write fails due to this limit, does it affect the entire EEPROM or just that memory address?

Each cell in the EEPROM is good for 100,000 writes (guaranteed). As I said, reads are unlimited. If you use the update() function to write new values to EEPROM, the value will be written only if the value to be written is different than the value already in the EEPROM. This prevents unnecessary writes.

In the circumstance where a write fails due to this limit, does it affect the entire EEPROM or just that memory address?

Only the cell that is "worn out" is affected.

100,000 will do!