Function EEPROM.update return

Hi everyone.

I have a question and I didn't find any information. (or I didn't know how to look for it).

The EEPROM.put() function uses the EEPROM.update() function to
write each byte of data to EEPROM.

If the byte value to be written by the EEPROM.update() function
is equal to the value that is already written to the EEPROM, writing is not necessary.

It is possible to know if the EEPROM.update() function needed to write?

Is there any feedback that informs if there was no recording?

Where (in the core of the IDE) I find the function code
EEPROM.update() ?

Thanks in advance.

RV mineirin

EEPROM.update() is of type void so there is no return value.

You can see the source at C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src

1 Like

Tks.

or, you could compare the new value with the last known value - and there’s your answer.

Don’t you trust the .update functionality ? :scream:

1 Like

Thanks @lastchancename for the answer.

No, it's not a distrust of the EEPROM.update function no.

It was an idea that came to me in a small project.
If I tried to write the value and found that it was the same, I wouldn't need to read it to compare with the current value.

RV mineirin

But that is exactly what .update() does. So, you can either let the library do it, or you can do it, but if you bother to read and compare, you might as well just .write() if they are not the same or else the library will repeat everything you have done.

1 Like

Tks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.