Neopixel + HID + Arduino Micro

Got something weird going on with a neopixel project and a Arduino Micro.

Code runs, emulates keystrokes as intended but upon the first power up the neopixel goes full white. Jumper the reset pin and the next time the code runs the pixel is correct. I have added an additional .1uf across the led +/- and a 470 Ohm on the data line. I have looked at both scenarios on the scope and nothing is jumping out. I also added a 10uf across vin just because. Neopixel is being powered via the usb 5v not the micro regulator.

#include "Keyboard.h"
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> 
#endif

#define NeoPIN        6 // Pin connected to neopixel
#define NUMPIXELS 1 

Adafruit_NeoPixel pixels(NUMPIXELS, NeoPIN, NEO_GRB + NEO_KHZ800);

const int buttonPin = 4;          // input pin for pushbutton
int previousButtonState = HIGH;   // for checking the state of a pushButton
int counter = 0;                  // button push counter

void setup() {
  pinMode(buttonPin, INPUT_PULLUP);
  // initialize control over the keyboard:
  
  delay(1000);
  pixels.begin();
  pixels.clear();
  pixels.setPixelColor(0, pixels.Color(255, 255, 255));
  pixels.show();
  Keyboard.begin();
}

void loop() {
  pixels.clear();
  pixels.setPixelColor(0, pixels.Color(0, 50, 0));
  pixels.show();


  if (digitalRead(buttonPin)== 0) {
        pixels.clear();
        pixels.setPixelColor(0, pixels.Color(255, 0, 0));
        pixels.show();
        Keyboard.print("~");
        delay(200);
  }

}

Any ideas?

I have added an additional .1uf across the led

You need something a bit more hefty here, I would use a 47uF capacitor.

I would add a delay between the initial showing of the pixels and starting the keyboard:-

pixels.show();
 delay(1000);
  Keyboard.begin();

To give time for the LED values to update before the USB enumeration begins.
You don't get the problem on a hardware reset because the USB enumeration has already happened as far as the computer is concerned.
However that might not even stop things on the initial power up.

Note that WS2812s can sometimes power up on. I normally see a bright magenta when this happens, but it doesn't always happen.
Try waiting until the serial interface is established before doing anything with a while( !Serial ) loop as recommended when useing this sort of Arduino.

Thanks, I will take a look at it again tonight. I experimented with several different delays between various parts of the setup code with no success. I even commented out all of the keyboard code and still had issues, so im assuming its something power or timing related. Ill take a closer look at the power rails with the scope after i add some extra capacitance on there.