How to Store 2 analogRead values and read using EEPROM for Arduino Uno? Trying to write 2 values coming from analogread(A0) and analogread(A1) by EEPROM.write  and retrieve the values by EEPROM.read. I tried the following sketch for each write and read. However, could not get the values. Any help please.

For writing to EEPROM:

#include &lt;EEPROMex.h&gt;
int addr = 0;
int array[] = {0, 0};
char a;
void setup() {
}
void loop() {
    array[0] = analogRead(0) / 4;
    array[1] = analogRead(1) / 4;
    EEPROM.write(addr, a);
    addr = addr + 1;

    if (addr == 512) {
        addr = 0;
    }

    delay(100);
}


For reading from EEPROM is:

#include &lt;EEPROM.h&gt;
int address = 0;
int value[2];
void setup() {
    Serial.begin(9600);

    while (!Serial) {
        ;
    }
}
void loop() {
    value = EEPROM.read(address);
    Serial.print(address);
    Serial.print("\t");
    Serial.print(value[0]);
    Serial.print("\t");
    Serial.print(value[1]);
    Serial.println();
    address = address + 1;

    if (address == 512) {
        address == 0;
    }

    delay(500);
}
See Reading and Writing Data Structures to EEPROM.

EEPROM.write(addr,a);


You can't directly write arrays. See the link for how to do it.

Example code:

#include &lt;EEPROM.h&gt;
#include &lt;EEPROMAnything.h&gt;

int array[2];
int addr=0;

void setup()
{  
}

void loop()
{
  array[0] = analogRead(0)/4;
  array[1] = analogRead(1)/4; 
  EEPROM_writeAnything(addr, array);
  addr += sizeof (array);

  if(addr &gt;= 512)
    exit (1);

  delay(100);
}


Your posted code is a bit flawed anyway. You know EEPROM has a limited life? If you have a sketch that writes to EEPROM indefinitely you will wear it out.

My code above stops once it reaches address 512.