Array Subscript Error

I was just trying to do a little script to run RBG Leds in a pattern on an Arduino Leonardo and for the life of me I can not figure out how to create an array subscript that will work. The rest of the code is not done, but this is what I have right now…

int ledPins[] = {2,3,4,5,6,7,8,9,10,11,12,13};  

void setup() {
  int index;
  {
    pinMode(ledPins[index], OUTPUT);
  }
}

void loop() {
  void oneAtATime();
}

void oneAtATime()
{
  int index1[] = {2,5,8};       
  int delayTime = 1000;         
  int delayTime2 = 500;

for(index1 = 0; index1 <= 2; index1++)  
  {
    digitalWrite(ledPins[index1], HIGH);
    delay(delayTime);                     
    digitalWrite(ledPins[index1], LOW);   
    delay(delayTime2);
  }
}
  int index;  //the value of index is undefined
  {
    pinMode(ledPins[index], OUTPUT);  //set one random pin to OUTPUT
  }

You are not setting any/all of the pins to OUTPUT

int index;
  {
    pinMode(ledPins[index], OUTPUT);
  }

You need a for loop or increment index and check for limit to feed array elements to pinMode. As it is the pinMode is only done once and the value of index is undefined as it is an uninitialized local variable.

Along with the above mentioned problem you need to index into intdex1 for oneAtATime() to make sense. Are the numbers in index1 supposed to index into ledPins? If so I think you want:

void oneAtATime()
{
  int index1[] = {2, 5, 8};
  int idx;
  int delayTime = 1000;
  int delayTime2 = 500;

  for (idx = 0; idx <= 2; idx++)
  {
    digitalWrite(ledPins[index1[idx]], HIGH);
    delay(delayTime);
    digitalWrite(ledPins[index1[idx]], LOW);
    delay(delayTime2);
  }
}
#define NUM_ENTRIES(ARRAY)      (sizeof(ARRAY) / sizeof(ARRAY[0]))

const uint8_t   ledPins[]   = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
const uint8_t   LED_OFF     = LOW;
const uint8_t   LED_ON      = HIGH;

void setup()
{
    for ( int index = 0; index < NUM_ENTRIES(ledPins); index++ )
    {
        pinMode(ledPins[index], OUTPUT);
    }
}

void loop()
{
    void oneAtATime();
}

void oneAtATime()
{
    const uint8_t       array[]     = { 2, 5, 8 };
    const unsigned long delayTime   = 1000UL;
    const unsigned long delayTime2  = 500UL;

    for ( int index = 0; index < NUM_ENTRIES(array); index++ )  
    {
        digitalWrite(ledPins[index], LED_ON );
        delay(delayTime);                     

        digitalWrite(ledPins[index], LED_OFF);
        delay(delayTime2);
    }
}