WS2812 LED light strips behaving weird

I had a long strip of WS2812 lights (300 LEDs) and had some code that was working completely fine. I decided to cut the strip so it would be the length of my desk but now the lights are acting strange and not following my code at all. I modified the code so it would work with the new length but now it doesn't work. I'm not sure if this is a hardware or software issue. I simplified the code to light up just one LED but all the LEDs light up and are random colors. Here is the code:

#include <FastLED.h>

#define NUM_LEDS 10
#define LED_PIN 6
CRGB led[NUM_LEDS];

void setup() {
  delay(100);
  FastLED.addLeds<WS2812, LED_PIN>(led, NUM_LEDS);
}

void loop() {
  led[0] = CHSV(100, 255, 255);
  FastLED.show();
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.