Using EEPROM to write a counter value I have made a program that increments a counter everytime the up button is pressed. I am trying to write this value to EEPROM, so that when I turn my board off and on again, the value before power off is shown on screen. 

I wrote this code but the value doesn't seem to be written to EEPROM. The counter incrementation works fine.

#include &lt;EEPROM.h&gt;
#include &lt;Adafruit_RGBLCDShield.h&gt;
#include &lt;utility/Adafruit_MCP23017.h&gt;
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

int addr = 0;
byte value;

void setup() {
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
}

int a;  
void loop() {
  uint8_t buttons = lcd.readButtons();
  if (buttons) {

    lcd.clear();
    lcd.setCursor(0,0);

    if (buttons &amp; BUTTON_UP) {
      a+= 1;
      EEPROM.write(addr, a);
      value = EEPROM.read(addr);
      lcd.print(value);
      delay(100);
    }
  }
}


Thanks for the help!
just add a = EEPROM.read(addr); in your setup
also, you can remove byte value and use a you wrote to memory in the previous line