EEPROM Library

This librariry provides access to internal 360 kB non-volatile EEPROM. Data written to EEPROM is saved even if Z-Uno is not powered. Use it to store data in battery and FLiRS devices that should survive battery unplug.
  • put
  • get
  • read
  • update
  • write
#include "EEPROM.h"

BYTE some_data[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee}; 
BYTE read_data[5];

void setup() {
  Serial.begin();
}

void loop() {
    byte i;
    word res;
    dword addr = 0x800;


    Serial.println("Reading 128 Bytes one by one from EEPROM...");
    for (i = 0; i < 128; i++) {
        Serial.print(EEPROM.read(i),HEX);
        if (((i % 0x10) == 0) && (i != 0))
          Serial.println();
        else
          Serial.print(' ');
    }

    Serial.println();

    Serial.println("Reading buffer from EEPROM...");
    res = EEPROM.get(addr, &read_data, sizeof(read_data));
    Serial.print("Read ");
    Serial.print(res);
    Serial.println(" Bytes");

    // write data to a specific address
    res = EEPROM.put(addr, &some_data, sizeof(some_data));
    
    delay(5000); // don't write to much in the EEPROM not to kill it
}
User parameters are also stored in the EEPROM. Design your layout not to override them!

User memory layout:
Start addressEnd addressSizeDescription
0x00000x1FFF8 kBUser memory
0x20000x20FF256 BUser configuration parameters
0x21000x3FFFF248 kBUser memory