beginEEPROM()

[EEPROM]
void beginEEPROM (unsigned short size, unsigned char byte_width = 1);

Description

Initializes the EEPROM memory, allowing the programmer to read and write data to the EEPROM.

Parameters

size: the size of the EEPROM memory.

byte_width: the width of the data to be written in bytes.

Returns

Nothing.

Example Code

The code initializes the EEPROM memory with a size of 1024 bytes and a data width of 1 byte.

void setup() {
    beginEEPROM(1024);  // initializes the EEPROM memory with a size of 1024 bytes and a data width of 1 byte
}

void loop() {
}

Notes and Warnings

  • The beginEEPROM() function must be called only once in the setup.
  • The byte_width parameter is optional, and if not specified, the default value is 1 byte.
  • This memory is non-volatile, so the data will be preserved even if the Custom Element is powered off, or iCircuit is closed.
  • To get the real size of the EEPROM in bytes, multiply the size parameter by the byte_width parameter.