I have a standard WS2812B LED strip. When I color the first LED (index 0) it works fine. When I color the second LED (index 1) with a white color and the first and second LED light up (the second has a greenish color). When I light the third LED (index 2) the second and third light up. When I color the fourth (index 3), it lights up the third LED only.
It's like the array index it being divided by a factor like 1.33. Any ideas why this would happen? Here's the super simple code:
Haha. I have no idea why that got italicized. The point of the code is simply to light one LED only and keep it that way. But it lights two.
This will happen down the line of my entire 144 light strip. When I set leds[143] to light up, an LED that's about 3/4 down the strip lights up. It's like my array index is being divided my a factor.
That is because you failed to read the how to use this forum sticky post. And if you can’t be bothered to read it, why should folk be bothered to help you.
for (int i=0;i<NUM_LEDS;i++) {
leds=0;
}
Does absolutely nothing. Learn how to use an array, and stop posting the same rubbish over and over.
Apologies for being new to this. I looked and couldn't find "how to use this forum sticky post". Please send me a link to that. When I copy & paste my code, the code get altered (square brackets sometimes disappear and text sometimes gets italicized). I also can't figure out how to pre-view my post so I can't check it before it's already posted. Sorry for wasting anyone's time.
I am setting the leds array element 1 to an arbitrary white light value of 12508340 (there is no connection between that number and Hereditary pancreatitis). So, one would think a single LED on a strip of 144 LEDs would light up. However two adjacent LEDs are lighting up. This only happens on certain LED strips that say they are WS2812B compatible. Other LED strips I've used in the past that are also WS2812B work fine.
am setting the leds array element 1 to an arbitrary white light value of 12508340 (there is no connection between that number and Hereditary pancreatitis). So, one would think a single LED on a strip of 144 LEDs would light up.
No you would not expect only one light to light up.
That is a big number and takes more than the 24 bits allotted for one array element. That is why it spills over into the next array element and you see two LEDs lit up.
Use proper sensible numbers and it will not happen.
Thank you all for your help! I've read through the FastLED Basic-usage and simplified my code. Here's what happens after every loop (each second):
1st: LED 0 is red
2nd: LED 1 is green
3rd: LED 1 is white
4th: LED 2 is blue
5th: LED 3 is red
6th: LED 4 is green
7th: LED 4 is white
8th: LED 5 is blue
9th: LED 6 is red
10th: LED 7 is green
I have run the code you posted in the last post. I can report that it behaves exactly like you would expect. That is the first 10 LEDs display as red with only one red LED on at any one time with all the other LEDs off.
No other colour is displayed, only one LED is on at one time, and only the first 10 LEDs in the strip are lit in the sequence.
So either your code does not match your processor, I used a Uno, or your strip does not match what you declared it to be in the code, or your strip is broken. Although I suppose some other hardware fault is possible.