How to control WS2812B LED strip

Hi all,

I want to use WS2812B LED strip for my project with Arduino UNO. I want to turn on specific number of LEDs in specific color at specific distance. My LED strip is 1mtrs and number of LEDs are 60. Could anyone please help me? How to program this

Hello vishnukarooliparambil

Welcome to the world's best Arduino forum ever.

Take a search engine of your choice and ask the WWW for 'WS2812B LED strip +arduino' to collect some data to be sorted out to get the needed information.

Have a nice day and enjoy coding in C++.

Do you know how to do simple things with the LED strip? Do you understand the example codes like e.g. FastLED's 'blink'?

Yes

Hi @vishnukarooliparambil

The WS2812B LED strip is really easy to use with Arduino, it has a ready to use library and connections are also very basic.
I made a detailed tutorial on how to use WS2812B with Arduino, link is here Addressable RGB Neopixel LED interfacing with Arduino

You can check out the circuit diagram and code from the link. Do note that I have used a small 8 LED strip but the procedure will remain the same for 60 LEDs also. If you make the connections and upload the given code you should be able to see your LEDs working.

After that, you can try to read and understand the code to be able to control the LED and Color as per your choice

OK Thanks for your reply. I just had a glimpse on your code. Now let me explain my requirements.
I would like to set the number of LEDs to turn on at a particular length. For eg. I want to turn on just 3 LEDs in Red starting from 20. That is LEDs 20,21&22 should turn on. Like wise I will change the position and number. How can I code it?

Pseudo code

for(int i = 20; i < 20; i++)
{
  leds[i] = red
}

for(int i = 23; i < 30; i++)
{
  leds[i] = green
}

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