Code NeoPixels in Array

I am trying to make a method that will do one thing to as many different NeoPixel objects I give it, and I need some pointers as to how to make this happen. I have tried to use an array as a parameter in order to do this, but the LEDs do not do anything. They do work on other programs, this is a code problem. Here is what I have, please give me input as to how to make this happen. 5V Adafruit Trinket.

#include <avr/power.h>
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel components[] = {Adafruit_NeoPixel(17, 0, NEO_GRBW + NEO_KHZ800),
                                Adafruit_NeoPixel(17, 1, NEO_GRBW + NEO_KHZ800)};
void setup()
{
  if(F_CPU == 16000000)
    clock_prescale_set(clock_div_1);
  for(byte a = 0; a < sizeof(components) / sizeof(components[0]); a++)
    components[a].begin();
}
void loop()
{
  sequenceColor(components, 0, 255, 0, 0);
}
void sequenceColor(Adafruit_NeoPixel elements[], byte red, byte green, byte blue, byte white)
{
  for(byte a = 0; a < sizeof(elements) / sizeof(elements[0]); a++)
  {
    for(byte b = 0; b < elements[a].numPixels(); b++)
      elements[a].setPixelColor(b, red, green, blue, white);
    elements[a].show();
  }
}

You can't pass an array as parameter. It's passed as reference. And after that, the function has NO idea about the size of the array. You can't do sizeof() on the array passed as reference. So you need to pass the size of the array as well :slight_smile:

Have a Google about passing arrays in C++ :slight_smile: