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?**
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
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.
That is going to be painfully slow.
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.
(Then you can start Bob's code with 10 times the largest number of reds.)
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...
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).