writeEEPROM16()

[EEPROM]
void writeEEPROM16(unsigned short address, unsigned short value);

Description

Writes a short value (16 bits) to the EEPROM memory at the specified address.

Parameters

address: the address where the data will be written.

value: the data to be written.

Returns

Nothing.

Example Code

The code initializes the EEPROM with a size of 1024 and a width of 2 bytes and writes the value 0x55FF to the EEPROM memory at the address 0x00.

void setup() {
    beginEEPROM(1024, 2);          // initializes the EEPROM memory with a size of 1024 * 2 bytes
    writeEEPROM16(0x00, 0x55FF);   // writes the value 0x55FF to the EEPROM memory at the address 0x00
}

void loop() {
}

Notes and Warnings

  • The writeEEPROM16() function can only be used after the beginEEPROM() function.
  • The value parameter must be a 16-bit value (0-65535) or an unsigned short.
  • If the programmer initializes the EEPROM with a width lower than 2 bytes, the function will write only 8 bits of the data.