   // End of trinket special code
 
   pixels.begin();
-  pixels2.begin();
+
+  for (int i = 0; i < fireflyPinCount; i++)
+  {
+    pinMode(fireflyPins[i], OUTPUT);
+  }
 }
 
 void loop()
 { 
   bool anyFirefliesActive = false;
-  for (int i = 0; i < numNeopixels; i++)
+  for (int i = 0; i < fireflyPinCount; i++)
   {
     anyFirefliesActive = anyFirefliesActive || fireflies[i].active;
   }
 
-  int forceActivateIndex = anyFirefliesActive ? -1 : random(numNeopixels);
+  int forceActivateIndex = anyFirefliesActive ? -1 : random(fireflyPinCount);
 
-  for (int i = 0; i < numNeopixels; i++)
+  for (int i = 0; i < fireflyPinCount; i++)
   {
     auto& firefly = fireflies[i];
 


#include "Color3F.h"

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
const int pinNeopixels = 5;
const int numNeopixels = 5;
const bool newPixelsAreRgb = false;
const int pinNeopixels2 = 3;
const int numNeopixels2 = 1;
const bool newPixelsAreRgb2 = true;

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
auto pixels = Adafruit_NeoPixel(numNeopixels, pinNeopixels, (newPixelsAreRgb ? NEO_RGB : NEO_GRB) + NEO_KHZ800);
auto pixels2 = Adafruit_NeoPixel(numNeopixels2, pinNeopixels2, (newPixelsAreRgb2 ? NEO_RGB : NEO_GRB) + NEO_KHZ800);

struct Firefly
{
  Color3F color;
  bool active = false;
  int lifetime = 0;
  int progress = 0;
};

Firefly fireflies[numNeopixels];

int fireflyChance() { return 400; }
int fireflyLifetime() { return random (150, 250); }

Color3F fireflyColor()
{
  switch (random(0, 3))
  {
    case 0: return Color3F(102, 255, 64) / 255.f;
    case 1: return Color3F(32, 128, 48) / 255.f;
    case 2: return Color3F(255, 255, 32) / 255.f;
  }

  return Color3Fs::Blue();
}

void setup()
{

        firefly.active = true;
        firefly.lifetime = fireflyLifetime();
        firefly.progress = 0;
      }
    }

    int s = sin((float)firefly.progress / firefly.lifetime * PI) * 255;
    analogWrite(fireflyPins[i], firefly.active ? s : 0);
  }

  auto glowScale = (sin((millis() % 4000) / 4000.f * 2 * PI) * 3 / 8 + 0.625);
  auto color = Color3F(255, 255, 64) * glowScale;
  pixels.setPixelColor(0, color.R, color.G, color.B);
  pixels.show();

  delay(10);
}
