| Index

| Reference for Wiring 1.0 (ALPHA) 0020+. 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 |  | ### read()
Examples |  |
    #include <WEEPROM.h>

    char val;

    void setup() {
      if(EEPROM.read(5) != 'H') {  // If an H hassn'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 == 'H' )      // if val is 'H' then turon ON the onboard LED (pin 48)
      {
        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 4096. The read() method reads a byte from the address specified.
Syntax |  |
    EEPROM.read(address)
Parameters |  |
address |  | int specifying an address value between 0 and 4096
Returns |  | byte
Usage |  | Application