# I'm finally done with the installation of my ledstrips in at my stairsway.

(Chris Chris) #1

I’m finally done with the installation of my ledstrips in at my stairsway.
Now i’m ready to start coding the whole program. I got some troubles with the logical wise thinking to control the led strips per level. I’m using a WS2812B Ledstrip. Each level has 30 led strips and I have 13 levels in total.

The main effect will be a fade starting from example the bottom. The first level wil starting light up, so the first 30 leds. While those are for example 50%, the next level (so led 29 to 59) will start with fading and so going to the next one.

Now I tried some things to group out each level. Please see my try below:

void loop() {
unsigned long currentMillis = millis();

EVERY_N_MILLISECONDS(1000) {
setTrede(gHue,255,255,2);
gHue++;
FastLED.show();
}

if(gHue = 255){
gHue = 0;
fill_solid( leds, NUM_LEDS, CRGB::Black);
FastLED.show();
delay(1000);
}

}

void setTrede(int hue,int sat,int val,int id){
for(int i = steps * id-1; i < steps * id; i++) {
Serial.println (i);
Serial.println (hue);
leds[i] = CHSV(hue, sat, val);
}
}

Is there any properly way to group a led range? How to easily control each 30 leds.

Actually I just found a good example which effect I would like to create;

Each level has a own ledstrip in his case, which is not in mine.

Can someone give me a kick in the correct direction?

(dalemorris164) #2

Try googling FastLED LEDSet
You can make an LEDArray and have subsets of the array to work on individual steps as a whole.

(Ken White) #3

@Chris_Chris - What you want to use is CRGBSet. Here are some sketches of mine that illustrate how to use CRGBSet to define a group of pixels and use those groups in a function:

and

Here is some FastLED documentation for CRBGSet:

and

(варешяф рйезот) #4

Look to this project:
https://evilgeniuslabs.org/tree-v2
There are nice decision to manipulating with logical leds sets.
p.s. Jason, sorry, I’m too often mention you ))

(Chris Chris) #5

@Ken_White Awesome. Make things much easier now.
But how to correctly call step1 = #color#, step2 = #color# etc etc in a array? Actually kind of “step”+i; or like in php “step”. \$i;

LEDs need to fade up and each step needs to have a delayed start.

(Chris Chris) #6

This code should be in an array…

(Ken White) #7

@Chris_Chris - The following sketch illustrates how to use CRGBSet for your step project and it is a starting point for you to use to develop more complex animations for your step project:

I do not have a strip with 390 NeoPixels so I have only compiled the sketch using an Arduino Nano as the board on the Arduino IDE 1.8.7 and it compiles. Please note that to do any more functions and to do any more complex animations, you should use a different MCU with more memory such as a Teensy 3.2, Lolin D32 (any ESP-32 board) or a Lolin D1 Mini Pro (any ESP-8266 board) since this simple sketch uses 68% of the dynamic memory on a Nano.

I am looking forward to seeing a video of your finished step project sometime in the future.

(Mark Estes) #8

@Ken_White Your example code was very helpful to me in understanding the CRGB set arrays. I use FastLED often but had not used this functionality. Super helpful. Note; I think your colorwipe_dot function is missing a FastLED.show(): somewhere in there.

(Ken White) #9

@Mark_Estes - Thank you. CRGBSet has been very useful to me in a number of projects.

Your 64X64 Matrix table project and the animations for that project are awesome.

As per the missing FastLED.show(), the FastLED.delay(variable) contains both a show function and a delay function. See lines 123 to 135, especially line 131, of the FastLED.cpp file and you can see this. See lines 68 and 69 of my step code where I forgot to delete the commented out FastLed.show() and delay(wait) lines.

(Mark Estes) #10

@Ken_White Wow, i had no idea FastLEDdelay(variable) had the show built in. I learn something good from this forum every day. Makes perfect sense now. Thanks.