Arduino needs to know the exact number of Define leds that will be used?

hello,
I'm working on a costume props project for which I have installed ws2812 strip leds which are in my costume props covered with foam glue and paint.,

but I forgot to count how many leds there are for the arduino to do its code accordingly the number of LEDs.

Is it important or not to define the number of leds that will be used for the power supply and the light animation code?

Thanks for your advice helps

arduino needs to know the exact number of Define leds that will be used?**

What is a ws82 led strip. Google is having a hard time finding that.

Did you cut the strip? If not, the strips come in certain numbers of pixels.

Otherwise you will probably have to find out by process of elimination. Make a guess, try it. Keep doing that till you know the number.

Welcome to the forum

Write yourself a small sketch that turns on the LEDs one by one with a delay between each and print the current LED number to the Serial monitor. Note the number printed when all of the LEDs have been turned on

In the test sketch #define the number of LEDs to be greater than the largest number of possible LEDs and refine it in your main sketch when you know how many there are

How are the LEDs powered ?

If you are asking whether there will be any problem defining a greater number of LEDs than actually exist in the chain, then no. What will happen is that the LEDs beyond (greater number) those that do exist will simply not be illuminated. :grin:

That is going to be painfully slow. :rofl:

Write some simple code that sets every odd LED to blue, every fifth LED to green and every tenth LED to red Should make it easy to count. :thinking:

(Then you can start Bob's code with 10 times the largest number of reds.)

But you only have to do it once !

It can, of course, be refined such that you do not start at the first LED if you know roughly how many there are and you could even work backwards from the highest number possible and note the number of the first LED that turns on

Well, sure. Put a light sensor on the last item in the string, and run a loop watching for that LED to light up. Should work like a charm. But then you can post a thread here when your light sensor doesn't work...:roll_eyes:

If you know where it is :grinning:

I'd set every 25th LED to red. That will give you four blues between greens and four greens between reds. Count off by 25's (reds) then 5's (greens) and then 1's (blue).

The problem I see is that on a costume, the LEDs may not be in a linear array.

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