Why aren't all LEDs controlled?

frankmehlhop
Posts: 3
Joined: Thu Jul 17, 2025 1:22 pm

Why aren't all LEDs controlled?

Postby frankmehlhop » Thu Jul 17, 2025 1:34 pm

I have an ESP32, a BTF-LIGHTING WS2812B 5M LED light strip and a 5V 10A RS-50-50 power supply unit.
I connect it like this:
Image

And I add this program:

Code: Select all

#include <FastLED.h>
#define NUM_LEDS 20
#define DATA_PIN 2
CRGB leds[NUM_LEDS];
void setup() 
{
  FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setBrightness(128);
}
void loop() 
{
  for(int i = 0; i <140; i++)
  {
    leds[i] = CRGB::Blue;
    FastLED.show();
    delay(50);
  }
  delay(50);
  for(int i = 0; i <140; i++)
  {
    leds[i] = CRGB::Black;
    FastLED.show();
    delay(50);
  }
}
Only the first 19 LED'S are controlled. The rest of the 140 LED's remain dark.
I tried with two different ESP32 with same result.
What could be the cause?

frankmehlhop
Posts: 3
Joined: Thu Jul 17, 2025 1:22 pm

Re: Why aren't all LEDs controlled?

Postby frankmehlhop » Thu Jul 17, 2025 2:16 pm

I would also like to add that some LEDs that come well after the 19th LED still light up with the color and from the previous project. I also find that remarkable.

frankmehlhop
Posts: 3
Joined: Thu Jul 17, 2025 1:22 pm

Re: Why aren't all LEDs controlled?

Postby frankmehlhop » Fri Jul 18, 2025 12:10 pm

The reason is because line 2.
I had limited the number to 20 instead of 140.

Thanks,
Frank

Who is online

Users browsing this forum: No registered users and 2 guests