How to light up individual pixels on a WS2812 LED strip?

Greetings,

I'm using a WS2812 LED strip (sj-ic219) for a school project and now I'm supposed to light up individual pixels continuously using one color. For example, on the same LED strip, I'd like to have pixel one continuously shining red and pixel two continuously shining blue. How could I make this happen? I've been looking around for hours, but the only code I can find is to make the pixels flash etc.

Thanks in advance.

Are you using a library? Reading the guide would be a good idea.

these are sooo much fun to work with...

I would start with a neopixel strip & refine your code. Once you have a code you are good with, set a variable that sets the amount of leds in your set.

If you need an example code let me know, I spent alot of time with these when I first started arduino, and took a fondness the them.

Each pixel has three bytes to define its color.
example: 60 (0-59) pixels needs 180 bytes of SRAM.
Study the concept of arrays, these start at element zero.
To make the 2 pixel 'full' white then bytes 3,4,5 need to contain 255 each.

When using the Adafruit library:
strip.setPixelColor(n,r,g,b); //2nd pixel, where n=1, r=255, g=255 and b=255. Full white.

See:

.

First of all, thank you to each and every single one of you for your replies.

INTP:
Are you using a library? Reading the guide would be a good idea.

Yes. I'm using the AdaFruit NeoPixel library and went through the guide several times :slight_smile:

rdlockrey:
If you need an example code let me know, I spent alot of time with these when I first started arduino, and took a fondness the them.

I'd love to get an example. In particular one where the individual pixels light up in different colors. Oddly enough I can't find any examples anywhere to control individual pixels, or I'm just doing something wrong, or the LED strip I'm using somehow doesn't support. The LED strip I have is working fine, but so far I have just not been able to change the color of the individual pixels. Changing the color overall is no problem though, nor setting it to chasing etc. But the individual pixels just always share the same color. strip.setPixelColor also didn't work for me.

LarryD:
Each pixel has three bytes to define its color.
example: 60 (0-59) pixels needs 180 bytes of SRAM.
Study the concept of arrays, these start at element zero.
To make the 2 pixel 'full' white then bytes 3,4,5 need to contain 255 each.

When using the Adafruit library:
strip.setPixelColor(n,r,g,b); //2nd pixel, where n=1, r=255, g=255 and b=255. Full white.

See:
The Magic of NeoPixels | Adafruit NeoPixel Überguide | Adafruit Learning System

I'm familiair with arrays. I've been digging through the guide you linked thoroughly, and made my code exactly in the way they do it (and in the way you describe it) but it doesn't work for me. For example, when I set it to...

strip.setPixelColor(1, 255, 255, 255); //2nd pixel, where n=1, r=255, g=255 and b=255

...all pixels stay off (the strip contains 3 pixels).

When I set it to...

strip.setPixelColor(0, 255, 255, 255);

...all pixels light up in the same color.

And when I for example set it to...

strip.setPixelColor(0, 255, 255, 255);
strip.setPixelColor(1, 0, 255, 0);

...it also lights lights up all pixels together and only in the same color as defined in strip.setPixelColor(0, 255, 255, 255);.

Finally, when I for example set it to...

strip.setPixelColor(1, 255, 255, 255);
strip.setPixelColor(2, 0, 255, 0);

...then none of them light up at all.

So I'm pretty much stuck still. Any further help is greatly appreciated. (Like for example, would it really work on the SJ-IC219 LED strip at all? Or would I have to use a different library for it? I've been told I can individually light up pixels on this LED strip, but I have my doubts.)

Show us your current sketch. Please use code tags. Use the </> icon in the posting menu. [code] Paste sketch here. [/code]
Show us a good schematic of your circuit. Show us a good image of your wiring.

.