Last WS2812B in string not lighting

I have a string of 24 WS2812B LED's and the last one was lighting errarticly I checked my connections and everything seamed fine. I moved my LED to a different location and it worked fine. I tried a different LED in location 24 and it doesn't work either so now i'm thinking its code. I ran the basic test code and it still doesn't light up. I've tried it with an UNO, an ESP8266, and a MEGA. All same problem. Here is my test code. is there an end of line termination thing I'm missing with the WS2812B's?

#include <Adafruit_NeoPixel.h>
#define PIN            6
#define NUMPIXELS      24
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 50; // delay for half a second

void setup() 
{
  pixels.begin(); // This initializes the NeoPixel library.
}

void loop() 
{
  for(int i=0;i<NUMPIXELS;i++)
  {
    pixels.setPixelColor(i, pixels.Color(150,150,150)); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
}

Can't see a problem with your code. No termination needed.

Could the problem be the next-to-last in the chain? Maybe it is not sending data out to the last in chain correctly?

Paul

Try moving these outside the for loop:

pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).

The last LED will never be controllable with the library that you are using. It is just the way the library is setup. Some libraries leave the first LED uncontrollable as well.

Maybe you have 25 pixels :wink:

OK I feel Stupid, "PaulRB", you had it pegged it was the 23'rd LED that was the problem. The D_Out pin wasn't putting anything out. Changed out that LED and all is now good! That is what happens when you buy a reel of 1000 WS2812B's directly from china i guess you get a bad LED from time to time haha. I put a scope on the D_out pin of the 23rd and nothing was coming out of it. Replaced the 23rd and everything was great. I don't know why it slipped my mind to not check that. This has been bugging me since last friday too haha.

Good.
Normally I load the array then pixel.show()

int delayval = 50; // delay for half a second

That's only 50mS, not 500mS. Good to see you got the hardware worked out.

engiboy11:
The last LED will never be controllable with the library that you are using. It is just the way the library is setup. Some libraries leave the first LED uncontrollable as well.

That is inconsistent with my experience with the adafruit neopixel library. All the LEDs work fine for me when I have my code right - and OP reports that it's working now that they've fixed a hardware problem. So if you're having problems with that library leaving one LED unlit, that problem is in your code or hardware, not the library :wink:

I have damaged a few of those WS2812s by overheating when soldering, I used lead solder in the end

DrAzzy:
That is inconsistent with my experience with the adafruit neopixel library. All the LEDs work fine for me when I have my code right - and OP reports that it's working now that they've fixed a hardware problem. So if you're having problems with that library leaving one LED unlit, that problem is in your code or hardware, not the library :wink:

The obvious answer to test that, was to specify NUMPIXELS as longer than the actual. There is no way for software to detect or determine how many pixels are in the chain.