Reference for Wiring version 0027+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name

EEPROM

Examples
#include "EEPROM.h"

char val;

void setup() {
  if(EEPROM.read(5) != 'H') {  // If an 'H' hasn't been stored before
                               // in the EEPROM address 5
    EEPROM.write(5, 'H');      // store an 'H' in EEPROM address 5
  }  
  val = EEPROM.read(5);        // read value stored in EEPROM address 5

  pinMode(48, OUTPUT);
}

void loop() {
  // if val is 'H' then turn ON the onboard LED (pin 48)
  if( val == 'H' )             
  {
    digitalWrite(48, HIGH);
  }
  delay(100);
}
Description EEPROM stands for Electrically Erasable Programmable Read Only Memory. It is a special kind of memory that retains its contents even when the power on the I/O board is turned off. The Wiring I/O board has 4K bytes of data EEPROM memory, which is a separate data space in which single bytes can be read and written. The EEPROM has an endurance of at least 100,000 write/erase cycles, which is not difficult to attain if you write data to it in a for loop, so special care has to be taken to avoid doing it by mistake. The EEPROM is ideal to store data that doesn't change that often, like permanent message strings, or configuration for an application, etc. The EEPROM data bytes are addressed linearly between 0 and 4095.
Syntax
EEPROM
Methods
read()
write()
Returns None
Usage Application
Updated on September 18, 2010 12:55:04am PDT

Creative Commons License