LEDs blinking with interruption (ARDUINO UNO+WS2812B+NeoPixel Library)

Hello,
Perhaps someone can help me to solve a problem.

What is my goal?
When a parameter (Analog Input) reaches a critical value then a set of 8 LEDs must blink. The other 100 LEDs must remain in a stable state. To “toogle” the LEDs I want to set a timer and then refresh the LEDs each time. I am using the library TimerObject for that purpose.
http://playground.arduino.cc/Code/ArduinoTimerObject
General question:
Is it possible to achieve my goal using a UNO, a display of 108 LEDs WS2812B, the library from Adafruit Neo Pixel and the library TimerObject? If so, then please take a look at my code. If no, then should I change my approach? Maybe the FastLED library?
Hardware:
I am using a lot of hardware but a simplified diagram it is attached.
Software:
I don’t want to post the whole code but here are the important parts.

// system states for the state machine
#define STOPPED   0
#define TURNON    1
#define RUNNING   2
#define TURNOFF   3

//required colors
#define YELLOW 0xFFFF00
#define GREEN 0x008000
#define RED 0xFF0000
#define BLACK 0x000000

/*
 Pin should be the Arduino pin you've got connected to the first pixel's DIN pin. LED_COUNT should be the number of breakout boards
*/
#define PIN 4
#define LED_COUNT 108

//libraries
#include <Adafruit_NeoPixel.h>
#include <TimerObject.h>

int auxArray[LED_COUNT];    //This array contains the state ("colors") of all LEDS. 
int redArray[LED_COUNT];    //This array identify the LEDs that must blink for the moment.

int state = STOPPED;
// Create an instance called "leds".
Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);
TimerObject *timer1 = new TimerObject(500);  //create a new timer. 500ms.

void setup()
{
  timer1->setOnTimer(&ToogleLEDState);  //Callback of the timer
  InitializeSystem();       // function to initialize system.
}

void loop()
{
  int potCurr;   //potentiometer that simulates current
  int potTemp; //potentiometer that simulates temperature
  switch (state)
  {
    case STOPPED:
      //More code
      break;
    case TURNON:
      //More code
      break;
    case RUNNING:
      timer1->Update();                            //Check the status of timer for LEDs
      potCurr = analogRead(potCurrPin);      // Read value
      potTemp = analogRead(potTempPin);   // Read value
      UpdateLED(potCurr, potTemp);
      break;
    case TURNOFF:
      //More code
      break;
    default:
      // Should never get here
      break;
  }
}

//initialize system
void InitializeSystem()
{
  for (int i = 0; i < LED_COUNT; i++)     //Initialize array
  {
    auxArray[i] = 200;                          //200 means nothing. It is just a initial value.
  }
  for (int i = 0; i < LED_COUNT; i++)    //Initialize array
  {
    redArray[i] = 200;
  }
  uint8_t bright = 32;
  leds.begin();  // Call this to start up the LED strip.
  clearLEDs();   // This function turns all LEDs off
  leds.setBrightness(bright);   //set the brithness. 
  leds.show();   // refresh leds
  timer1->Start();
  // More code. Not important
}
//in the future this function should be bigger
void DoWhenStopped()
{
  // More code. Not important
  state = STOPPED;
  timer1->Stop();
}
//in the future this function should be bigger
void DoWhenTurningOn()
{
  // More code. Not important
  state = RUNNING;
}
// Sets all LEDs to off, but DOES NOT update the display;
void clearLEDs()
{
  for (int i = 0; i < LED_COUNT; i++)
  {
    leds.setPixelColor(i, 0);
  }
}
//Handle new values
void UpdateLED(int currVal1, int tempVal1)
{
  int currArray[] = {currVal1};      //assignation
  int tempArray[] = {tempVal1};   
  for ( int i = 0; i < 1; i++)  //convert values to a defined state
  {
    currArray[i] = CoerceCurrent(currArray[i]);   //Force values to have a stable value.
    tempArray[i] = CoerceTemp(tempArray[i]);       
  }
  for ( int i = 0; i < 1; i++) //Read the coerced values through the array to define the LED states
  {
    switch (currArray[i])
    {
      case 0:
        // More code. Not important
        break;
      case 1:
        // More code. Not important
        break;
      case 2:
        // More code. 
        break;
      case 3:
        // More code. 
        break;
      case 4:
        // More code. 
        break;
      case 5:
        // More code.
        break;
      case 6:
        // More code. 
        break;
      case 7:
        // More code. 
        break;
      case 90:
        // More code. Not important
        break;

      case 100:
        auxArray[(i * 18)] = 1; //RED
        auxArray[(i * 18) + 1] = 1; //RED
        auxArray[(i * 18) + 2] = 1; //RED
        auxArray[(i * 18) + 3] = 1; //RED
        auxArray[(i * 18) + 4] = 1; //RED
        auxArray[(i * 18) + 5] = 1; //RED
        auxArray[(i * 18) + 6] = 1; //RED
        auxArray[(i * 18) + 7] = 1; //RED
        auxArray[(i * 18) + 8] = 1; //RED
        for ( int j = 0; j < 9; j++)
        {
          redArray[(i * 18) + j] = 1; //Store 1 at index of those elements into redArray. Important to define which LEDs must blink.
        }
        break;
      default:
        // More code.
        break;
    }
    switch (tempArray[i])
    {
      //Similar to switch case of CurrArray
      case 7:
        auxArray[(i * 18) + 9] = 1; //RED         Example of my cases
        auxArray[(i * 18) + 10] = 2; //YELLOW
        auxArray[(i * 18) + 11] = 2; //YELLOW
        auxArray[(i * 18) + 12] = 3; //GREEN
        auxArray[(i * 18) + 13] = 3; //GREEN
        auxArray[(i * 18) + 14] = 3; //GREEN
        auxArray[(i * 18) + 15] = 2; //YELLOW
        auxArray[(i * 18) + 16] = 2; //YELLOW
        auxArray[(i * 18) + 17] = 0; //BLACK
        break;

      case 100:
        //Similar to case100 of currArray
        auxArray[(i * 18) + 9] = 1; //RED
        for ( int j = 0; j < 9; j++)
        {
          redArray[(i * 18) + 9 + j] = 1; //Store 1 at index of those elements into redArray
        }
        break;
    }
  }
  for ( int i = 0; i < 1; i++)
  {
    if ((currArray[i] == 100) || (tempArray[i] == 100)) //If a values requires to "blink" then......
    {
      timer1->Resume();   //Resume the timer
      break;
    }
    else
    {
      timer1->Pause();       //Pause the timer and reset redArray
      for (int j = 0; j < LED_COUNT; j++)
      {
        redArray[j] = 200;
      }
    }
  }
  timer1->Update();     //Check the status of timer for LEDs.
  RefreshLEDs();
leds.show();
}
//Change the value to a defined integer. 90 represent the state 90% of critical value and 100 means 100% of critical value.
int CoerceCurrent(int Val)
{
  // More code.
  return aux;  //It has a value of 0,1,2,3,4,5,6,7,90 or 100
}
//Similar to CoerceCurr
int CoerceTemp(int Val)
{
  // More code.  
}
//Callback of the timer.
void ToogleLEDState()
{
  for ( int i = 0; i < LED_COUNT; i++)
  {
    if (redArray[i] == 1) //Only if the element was marked in the function UpdateLED
    {
      if (auxArray[i] == 1)
      {
        auxArray[i] = 0;
      }
      else if (auxArray[i] == 0)
      {
        auxArray[i] = 1;
      }
    }
  }
  RefreshLEDs();  //This makes the callback very long and it might produce a race situation.
  leds.show();     //This functions disable the interruptions. Perhaps this is the cause of my problems.
}
void RefreshLEDs()
{
  for ( int i = 0; i < LED_COUNT; i++)
  {
    switch (auxArray[i])
    {
      case 0:
        leds.setPixelColor(i, BLACK);
        break;
      case 1:
        leds.setPixelColor(i, RED);
        break;
      case 2:
        leds.setPixelColor(i, YELLOW);
        break;
      case 3:
        leds.setPixelColor(i, GREEN);
        break;
      default:
        leds.setPixelColor(i, RED);
        break;
    }
  }
  leds.show();   //Refresh and display the LEDs
}

If you look at my code there are many optimizations like the function UpdateLED should be called just when a parameter has changed its value. The callback of the timer is perhaps too long.
Actual problem:
The Software does what I want but when the potentiometer reaches the maximum value happens the following:

  1. Either they remain turned on with a red color
  2. Or they remain turned off
    If I decrease the value of the potentiometer then everything is OK and works as I want.
    Some other questions:
    a) Even if my hardware and software are capable to do whatever I want, should I change my approach?
    b) If the structure of the software is correct, then why the LEDs are not blinking?
    c) May be the array approach is not the best solution to keep a tracking of the LED States and the blinking ones.
    Thank you very much.
    Juan Gutierrez
    P.S. Explanations and more Information can be provided if you required them. (También en espanol. Auch auf Deutsch)

Hi Juan and welcome.

Your diagram is very impressive, but I don't think it helps anyone understand your problem at all.

Essentially the project is an Uno, 108 ws2812 leds and a pot (or is it two pots, and if so what is the second pot for?)

108 ws2812 leds could draw around 6.5A current. Can your power supply support that?

I have a possible theory about the problem with your code. From the parts of the code that you have chosen to show us, I can see that you are using the Adafruit Neopixel object to control the leds. This will require 108 x 3 = 324 bytes of RAM. I also see two int arrays, so that is 2 x 2 x 108 bytes = 432 bytes. In total that is almost 800 bytes, plus whatever the other parts of your code need. The Uno has only 2048 bytes available. You could make those int arrays into byte arrays, that would save something.

Paul