write()

Description

Write a byte to the EEPROM.

Syntax


EEPROM.write(address, value)

Parameters

address: the location to write to, starting from 0 (int)
value: the value to write, from 0 to 255 (byte)

Returns

none

Note

If you use the 16 KB bank of virtual EEPROM, a write will take longer time (200~250us on the average) to complete; moreover, being implemented using the on-board flash, this bank has a limited life of write/erase cycles, so you may need to be careful about how often you write to it. The 200-byte CMOS bank of virtual EEPROM is faster (take 2~3us to write) and has no the above restriction, but, if you remove the on-board CMOS battery, the CMOS bank of virtual EEPROM will lose all data.

Example


#include <EEPROM.h>

void setup()
{
  for (int i = 0; i < 200; i++)
    EEPROM.write(i, i);
}

void loop()
{
} 

See also

EEPROM.read()


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.