Hello FastLED community.
My name is Robert and I am here with a newbie/first timer question.
Is this the fastest way to do a fill effect on an LED strip?
I am have 3 meters of APA102 144/M RGB in a line, I have plans that go beyond this example.
Though i would like to know if i am going about this lightsaber-like power up effect in the right way?
#include <SPI.h>
#include <FastLED.h> // FastLED Version 3.1.3
#define NUM_LEDS 432
#define DATA_PIN 32
#define CLOCK_PIN 33
#define COLOR_ORDER BGR
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds, NUM_LEDS);
}
void loop() {
for (int x = 0; x < 432; x++)
{
fill_solid( leds, x,0xFFFFFF); // HEX Code for WHITE
FastLED.show();
}
} // END
Get rid of the for loop and do leds(0,NUM_LEDS-1) = CRGB::White
NICE!
Thanks for the quick response; I will try this after work today.
Seeing as a light saber doesn’t turn on all at once, if I were to use solid colours, I’d probably use:
void startup() {
for(int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Grey;
show_at_max_brightness_for_power();
delay(10);
}
} // startup()
or pick some other colour. Then again, I love to use palettes and noise, so here’s one with a bit of a shimmery effect:
@Robert_Torres Are you trying to set all LEDs to white at the same time or are you wanting it to fill 1 by 1 until they are all on?
Hey Guys.
Just got home. Going to try the code samples you have provided.
Brian, to answer your question I am trying to fill 1 by 1.
@Robert_Torres Ok, my suggestion won’t work for that since it sets them all at the same time. Andrew’s reply will work great and using grey is probably a better idea than white since it won’t be so blindingly bright. You can replace “show_at_max_brightness_for_power()” with “FastLED.show()” The max brightness for power stuff is deprecated and is rolled into the .show function now.
Very helpful advice.
Will do
I have tested Andews method and the results seem similar to the for loop i had been ran previously.
Which is not a bad thing at all.
Thank you both for your valuable input!
@Brian_Lewis Thanks for the update. I’ve now updated all my sketches in one fell swoop with:
find ‘FastLED Sketches’ -type f -print0 | xargs -0 sed -i ‘s/show_at_max_brightness_for_power/FastLED.show/g’
@Andrew_Tuline You’re welcome. When I saw your post I thought that I was using that feature wrong so I did some looking in the code to see how it actually works and found a comment saying that was all rolled into the show function.