Arduino Function: EEPROM.read

Description

The read() method, reads a byte from the address specified. Locations that have never been written to have the value of 255.

Syntax

EEPROM.read(address)

Parameters

address: int specifying an address value between 0 and 4095.

Returns

 byte: the value stored in that location

Examples

#include "EEPROM.h"

char val;

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

  pinMode(48, OUTPUT);
}

void loop() {
  // if val is 'Z' then turn ON the onboard LED (pin 48)
  if ( val == 'Z' )             
  {
    digitalWrite(48, HIGH);
  }
  delay(100);
}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc