Do I understand the code in
EEPROM.cpp / write() correctly, that
val is only written to the EEPROM, if
val differs from the current EEPROM contents at the given
And if the answer is yes, what is
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
From library Library, see fragment:
EEPROM.write does not write to flash immediately, instead you must call EEPROM.commit() whenever you wish to save changes to flash. EEPROM.end() will also commit, and will release the RAM copy of EEPROM contents.
Probably to prevent too many writes into the same page (mostly EEPROM is divided in pages), the write stores it into some temporary buffer and the commit actually writes it to EEPROM. This decreases the number of writes, and since the number of writes has a maximum, the lifetime of the EEPROM is increased.
Update: Majenko's comment mentions no EEPROM is used, but flash, see below.