Reference Language (extended) | Libraries | Comparison | Changes
Write a byte to the EEPROM.
address: the location to write to, from 0 to 511 (int)
value: the value to write, from 0 to 255 (byte)
none
The Atmega 168 datasheet says that EEPROM memory has a specified life of 100000 write/erase cycles, so there is a limit to how many times you can write information to that memory space. Keep this in mind for long-lived projects or fast-moving data.
The datasheet also specifies that a write cycle takes 3.3 ms to complete. Other EEPROM write and read requests will fail if executed in this time period. This delay appears to be built into the EEPROM library as a casual test shows each cycle taking 3.33 ms to execute.
Hence, you do not specifically need to add a delay to an EEPROM write, just be aware of the built-in time delay.
#include <EEPROM.h> void setup() { for (int i = 0; i < 512; i++) EEPROM.write(i, i); } void loop() { }
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.