Attiny85 EEPROM to store last pattern in case of power loss

hi guys, looking to implement the above any help how to do it?
Attiny85 EEPROM to store last pattern in case of power loss

#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>

/*
  WS2811/Neopixel pattern switcher for ATtiny85 (and Arduino)
  Requires Adafruit NeoPixel Library
  WS2811 Signal, Digital Pin 4
  Button, Digital Pin 0
  GPL v3
*/

// Define
#define NUM_LEDS 2
#define DATA_PIN 4
#define BTN_PIN 0
#define BTN_DELAY 250
#define NUM_PATTERNS 10
#define CTR_THRESH 16

// Init Vars
uint8_t j = 0;
uint8_t pattern = 1;
uint8_t buttonState = 0;
uint8_t lastPix = 0;
uint8_t myPix = 0;
uint8_t direction = 1;
uint8_t counter = 0;
uint8_t colors[3];
uint32_t setColor = 0;
unsigned long mark;

// Start Strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(BTN_PIN, INPUT);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

}
void loop() {
  // if button pressed, advance, set mark
  chkBtn(digitalRead(BTN_PIN));

  // if pattern greater than #pattern reset
  if (pattern > NUM_PATTERNS) 
  {
    pattern = 1;
  }

  // choose a pattern
  pickPattern(pattern);
 



  // set direction
  if (direction == 1) {
    j++;
  } else {
    j--;
  }

  if (j > 254) {
    direction = 0;
  }
  if (j < 1) {
    direction = 1;
  }

}

/* pick a pattern */
void pickPattern(uint8_t var) {

  switch (var) {
    case 1:
      // scanner, color and delay - RGB
      scanner(strip.Color(255, 0, 0), 50);
      scanner(strip.Color(200, 0, 100), 50);
      scanner(strip.Color(64, 0, 200), 50);
      break;
    case 2:
      // color wipe random RGB
      colorWipe(strip.Color(random(255), random(255), random(255)), 50);
      break;
    case 3:
      // color wave - Hue/Sat/Bright
      // hue low (0-359), high (0-359),rate,extra delay
      wavey(200, 240, 0.06, 0);
      break;
    case 4:
      // rainbow firefly, 1px at random
      colorFirefly(60);
      counter++;
      break;
    case 5:
      // rainbow solid
      rainbow(10);
      counter++;
      break;
    case 6:
      // bounce in and out
      // tail len, counter, delay
      bounceInOut(4, counter, 20);
      counter++;
      break;
    case 7:
      // color wipe from center
      colorWipeCenter(strip.Color(255, 0, 0), 100);
      colorWipeCenter(strip.Color(255, 64, 0), 100);
      break;
    case 8:
      // solid color
      colorFast(strip.Color(255, 255, 255), 0);
      break;
    case 9:
      // fade even or odd
      // 0-359 Hue value, even/odd, delay
      fadeEveOdd(200, 0, 20);
      fadeEveOdd(300, 1, 20);
      break;
    case 10:
      // show rainbow
      rainbowCycle(10);
      break;
  }
}

/* check button state */
boolean chkBtn(int buttonState) {
  if (buttonState == HIGH && (millis() - mark) > BTN_DELAY) {
    j = 0;
    mark = millis();
    pattern++;
    return true;
  }
  else {
    return false;
  }
}

void colorFirefly(int wait) {
  if (myPix != lastPix) {
    if (counter < CTR_THRESH) {
      float colorV = sin((6.28 / 30) * (float)(counter)) * 255;
      HSVtoRGB((359 / CTR_THRESH)*counter, 255, colorV, colors);
      strip.setPixelColor(myPix, colors[0], colors[1], colors[2]);
      strip.show();
      delay(wait);
    } else {
      lastPix = myPix;
      counter = 0;
      colorFast(0, 0);
    }
  } else {
    myPix = random(0, strip.numPixels());
  }

}

// Fill the dots one after the other with a color
// Modified from Neopixel sketch to break on button press

void colorWipe(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

// color wipe from center
void colorWipeCenter(uint32_t c, uint8_t wait) {
  uint8_t mid = strip.numPixels() / 2;
  strip.setPixelColor(mid, c);
  for (uint16_t i = 0; i <= strip.numPixels() / 2; i++) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.setPixelColor(mid + i, c);
    strip.setPixelColor(mid - i, c);
    strip.show();
    delay(wait);
  }
}

// fast version
void colorFast(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
  }
  strip.show();
  delay(wait);
}

// Rainbow Cycle, modified from Neopixel sketch to break on button press
void rainbowCycle(uint8_t wait) {
  uint16_t i;

  //  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
  for (i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
  }
  strip.show();
  delay(wait);
  // }
}

void rainbow(uint8_t wait) {
  uint16_t i;

  //for(j=0; j<256; j++) {
  for (i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, Wheel((i + j) & 255));
  }
  strip.show();
  delay(wait);
  // }
}

// scanner

void scanner(uint32_t c, uint8_t wait) {
  for (int i = 0; i < strip.numPixels(); i++) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }

    colorFast(0, 0);
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
  for (int i = strip.numPixels(); i > 0; i--) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    colorFast(0, 0);
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

// scanner to midpoint
void bounceInOut(uint8_t num, uint8_t start, uint8_t wait) {
  colorFast(0, 0);
  uint8_t color = 200;
  for (int q = 0; q < num; q++) {
    if (strip.numPixels() - start >= 0 && start < NUM_LEDS) {
      strip.setPixelColor(start + q, strip.Color(0, color, 0));
      strip.setPixelColor(strip.numPixels() - start - q, strip.Color(0, color, 0));
    }
    color = round(color / 2.0);
    strip.show();
    delay(wait);
  }
  if (counter > strip.numPixels()) {
    counter = 0;
  }
}

void fadeEveOdd(int c1, byte rem, uint8_t wait) {
  for (int j = 0; j < CTR_THRESH; j++) {
    for (int i = 0; i < strip.numPixels(); i++) {
      if (i % 2 == rem) {
        HSVtoRGB(c1, 255, (255 / CTR_THRESH)*j, colors);
        strip.setPixelColor(i, colors[0], colors[1], colors[2]);
      }
    }
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.show();
    delay(wait);
  }
  for (int j = CTR_THRESH; j >= 0; j--) {
    for (int i = 0; i < strip.numPixels(); i++) {
      if (i % 2 == rem) {
        HSVtoRGB(c1, 255, (255 / CTR_THRESH)*j, colors);
        strip.setPixelColor(i, colors[0], colors[1], colors[2]);
      }
    }
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.show();
    delay(wait);
  }
}

// twinkle random number of pixels
void twinkleRand(int num, uint32_t c, uint32_t bg, int wait) {
  // set background
  colorFast(bg, 0);
  // for each num
  for (int i = 0; i < num; i++) {
    strip.setPixelColor(random(strip.numPixels()), c);
  }
  strip.show();
  delay(wait);
}

// sine wave, low (0-359),high (0-359), rate of change, wait
void wavey(int low, int high, float rt, uint8_t wait) {
  float in, out;
  int diff = high - low;
  int step = diff / strip.numPixels();
  for (in = 0; in < 6.283; in = in + rt) {
    for (int i = 0; i < strip.numPixels(); i++) {
      out = sin(in + i * (6.283 / strip.numPixels())) * diff + low;
      HSVtoRGB(out, 255, 255, colors);
      strip.setPixelColor(i, colors[0], colors[1], colors[2]);
    }
    strip.show();
    delay(wait);
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
  }
}
#define NUM_LEDS 2
#define DATA_PIN 4
#define BTN_PIN 0
#define BTN_DELAY 250
#define NUM_PATTERNS 10
#define CTR_THRESH 16

// Init Vars
uint8_t j = 0;
uint8_t pattern = 1;
uint8_t buttonState = 0;
uint8_t lastPix = 0;
uint8_t myPix = 0;
uint8_t direction = 1;
uint8_t counter = 0;
uint8_t colors[3];
uint32_t setColor = 0;
unsigned long mark;

// Start Strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  EEPROM.begin();
  pinMode(BTN_PIN, INPUT);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  pattern = EPROM.read(0);
}
void loop() {
  // if button pressed, advance, set mark
  chkBtn(digitalRead(BTN_PIN));

  // if pattern greater than #pattern reset
  if (pattern > NUM_PATTERNS)
  {
    pattern = 1;
  }

  // choose a pattern
  pickPattern(pattern);
  EEPROM.update(0, pattern);
 



  // set direction
  if (direction == 1) {
    j++;
  } else {
    j--;
  }

  if (j > 254) {
    direction = 0;
  }
  if (j < 1) {
    direction = 1;
  }

}

/* pick a pattern */
void pickPattern(uint8_t var) {

  switch (var) {
    case 1:
      // scanner, color and delay - RGB
      scanner(strip.Color(255, 0, 0), 50);
      scanner(strip.Color(200, 0, 100), 50);
      scanner(strip.Color(64, 0, 200), 50);
      break;
    case 2:
      // color wipe random RGB
      colorWipe(strip.Color(random(255), random(255), random(255)), 50);
      break;
    case 3:
      // color wave - Hue/Sat/Bright
      // hue low (0-359), high (0-359),rate,extra delay
      wavey(200, 240, 0.06, 0);
      break;
    case 4:
      // rainbow firefly, 1px at random
      colorFirefly(60);
      counter++;
      break;
    case 5:
      // rainbow solid
      rainbow(10);
      counter++;
      break;
    case 6:
      // bounce in and out
      // tail len, counter, delay
      bounceInOut(4, counter, 20);
      counter++;
      break;
    case 7:
      // color wipe from center
      colorWipeCenter(strip.Color(255, 0, 0), 100);
      colorWipeCenter(strip.Color(255, 64, 0), 100);
      break;
    case 8:
      // solid color
      colorFast(strip.Color(255, 255, 255), 0);
      break;
    case 9:
      // fade even or odd
      // 0-359 Hue value, even/odd, delay
      fadeEveOdd(200, 0, 20);
      fadeEveOdd(300, 1, 20);
      break;
    case 10:
      // show rainbow
      rainbowCycle(10);
      break;
  }
}

/* check button state */
boolean chkBtn(int buttonState) {
  if (buttonState == HIGH && (millis() - mark) > BTN_DELAY) {
    j = 0;
    mark = millis();
    pattern++;
    return true;
  }
  else {
    return false;
  }
}

void colorFirefly(int wait) {
  if (myPix != lastPix) {
    if (counter < CTR_THRESH) {
      float colorV = sin((6.28 / 30) * (float)(counter)) * 255;
      HSVtoRGB((359 / CTR_THRESH)*counter, 255, colorV, colors);
      strip.setPixelColor(myPix, colors[0], colors[1], colors[2]);
      strip.show();
      delay(wait);
    } else {
      lastPix = myPix;
      counter = 0;
      colorFast(0, 0);
    }
  } else {
    myPix = random(0, strip.numPixels());
  }

}

// Fill the dots one after the other with a color
// Modified from Neopixel sketch to break on button press

void colorWipe(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

// color wipe from center
void colorWipeCenter(uint32_t c, uint8_t wait) {
  uint8_t mid = strip.numPixels() / 2;
  strip.setPixelColor(mid, c);
  for (uint16_t i = 0; i <= strip.numPixels() / 2; i++) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.setPixelColor(mid + i, c);
    strip.setPixelColor(mid - i, c);
    strip.show();
    delay(wait);
  }
}

// fast version
void colorFast(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
  }
  strip.show();
  delay(wait);
}

// Rainbow Cycle, modified from Neopixel sketch to break on button press
void rainbowCycle(uint8_t wait) {
  uint16_t i;

  //  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
  for (i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
  }
  strip.show();
  delay(wait);
  // }
}

void rainbow(uint8_t wait) {
  uint16_t i;

  //for(j=0; j<256; j++) {
  for (i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, Wheel((i + j) & 255));
  }
  strip.show();
  delay(wait);
  // }
}

// scanner

void scanner(uint32_t c, uint8_t wait) {
  for (int i = 0; i < strip.numPixels(); i++) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }

    colorFast(0, 0);
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
  for (int i = strip.numPixels(); i > 0; i--) {
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    colorFast(0, 0);
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

// scanner to midpoint
void bounceInOut(uint8_t num, uint8_t start, uint8_t wait) {
  colorFast(0, 0);
  uint8_t color = 200;
  for (int q = 0; q < num; q++) {
    if (strip.numPixels() - start >= 0 && start < NUM_LEDS) {
      strip.setPixelColor(start + q, strip.Color(0, color, 0));
      strip.setPixelColor(strip.numPixels() - start - q, strip.Color(0, color, 0));
    }
    color = round(color / 2.0);
    strip.show();
    delay(wait);
  }
  if (counter > strip.numPixels()) {
    counter = 0;
  }
}

void fadeEveOdd(int c1, byte rem, uint8_t wait) {
  for (int j = 0; j < CTR_THRESH; j++) {
    for (int i = 0; i < strip.numPixels(); i++) {
      if (i % 2 == rem) {
        HSVtoRGB(c1, 255, (255 / CTR_THRESH)*j, colors);
        strip.setPixelColor(i, colors[0], colors[1], colors[2]);
      }
    }
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.show();
    delay(wait);
  }
  for (int j = CTR_THRESH; j >= 0; j--) {
    for (int i = 0; i < strip.numPixels(); i++) {
      if (i % 2 == rem) {
        HSVtoRGB(c1, 255, (255 / CTR_THRESH)*j, colors);
        strip.setPixelColor(i, colors[0], colors[1], colors[2]);
      }
    }
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
    strip.show();
    delay(wait);
  }
}

// twinkle random number of pixels
void twinkleRand(int num, uint32_t c, uint32_t bg, int wait) {
  // set background
  colorFast(bg, 0);
  // for each num
  for (int i = 0; i < num; i++) {
    strip.setPixelColor(random(strip.numPixels()), c);
  }
  strip.show();
  delay(wait);
}

// sine wave, low (0-359),high (0-359), rate of change, wait
void wavey(int low, int high, float rt, uint8_t wait) {
  float in, out;
  int diff = high - low;
  int step = diff / strip.numPixels();
  for (in = 0; in < 6.283; in = in + rt) {
    for (int i = 0; i < strip.numPixels(); i++) {
      out = sin(in + i * (6.283 / strip.numPixels())) * diff + low;
      HSVtoRGB(out, 255, 255, colors);
      strip.setPixelColor(i, colors[0], colors[1], colors[2]);
    }
    strip.show();
    delay(wait);
    if (chkBtn(digitalRead(BTN_PIN))) {
      break;
    }
  }
}

simplified it a bit but doesnt work , did i do something wrong?

#include <FastLED.h>
#include <EEPROM.h>
#define NUM_LEDS 2
CRGB leds[NUM_LEDS];
#define DATA_PIN 4
#define CLOCK_PIN 13
#define MAX_BRIGHTNESS 160 // Thats full on, watch the power!
#define MIN_BRIGHTNESS 40 // set to a minimum of 25%
int val = 1;
int sequence = 1;

void setup()
{
  //EEPROM.begin();
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  //sequence = EEPROM.read(0);
}

void loop() {

  val = digitalRead(0);
  if (val == HIGH)
  {
    if (sequence == 3)
    {
      sequence = 1;
    }
    else
    {
      sequence++;
      //EEPROM.update(0, sequence);
    }
    delay(200);
    
  }

  switch (sequence)
  {
    case 1:
      FastLED.setBrightness(MIN_BRIGHTNESS);
      Strobe(0xff, 0xff, 0x00, 10, 20, 500); //byte red, byte green, byte blue, StrobeCount, FlashDelay, EndPause
      break;
    case 2:
      FastLED.setBrightness(MAX_BRIGHTNESS);
      TwinkleRandom(20, 100, false);
      break;
    case 3:
      FastLED.setBrightness(MIN_BRIGHTNESS);
      FadeInOut(0xff, 0x77, 0xff);
      break;
  }
      
}

void TwinkleRandom(int Count, int SpeedDelay, boolean OnlyOne) {
  setAll(0, 0, 0);
  for (int i = 0; i < Count; i++) {
    setPixel(random(NUM_LEDS), random(0, 255), random(0, 255), random(0, 255));
    showStrip();
    delay(SpeedDelay);
    if (OnlyOne) {
      setAll(0, 0, 0);
    }
  }
  delay(SpeedDelay);
}

void Strobe(byte red, byte green, byte blue, int StrobeCount, int FlashDelay, int EndPause) {
  for (int j = 0; j < StrobeCount; j++)
  {
    setAll(red, green, blue);
    showStrip();
    delay(FlashDelay);
    setAll(0, 0, 0);
    showStrip();
    delay(FlashDelay);
  }
  delay(EndPause);
}
void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H  // NeoPixel
  strip.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
  // FastLED
  FastLED.show();
#endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif

#ifndef ADAFRUIT_NEOPIXEL_H
  // FastLED
  leds[Pixel].r = red;
  leds[Pixel].g = green;
  leds[Pixel].b = blue;
#endif

}
void setAll(byte red, byte green, byte blue) {
  for (int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
  }
  showStrip();
}
void FadeInOut(byte red, byte green, byte blue)
{

  float r, g, b;
  for (int k = 0; k < 256; k = k + 1) {
    r = (k / 256.0) * red;
    g = (k / 256.0) * green;
    b = (k / 256.0) * blue;
    setAll(r, g, b);
    showStrip();
  }
  for (int k = 255; k >= 0; k = k - 2) {
    r = (k / 256.0) * red;
    g = (k / 256.0) * green;
    b = (k / 256.0) * blue;
    setAll(r, g, b);
    showStrip();
  }
}