Hey everyone. I am just getting started with FastLED,

Hey everyone. I am just getting started with FastLED, and I have a few questions. First, is there a way to code a group of leds and set the (same) color for all of them in one line? (say leds 1-3,5,10-12 etc) I can get what I want to do but it requires a line of code for each led. Another, has anyone programed a bunch of effects on the same sketch and changed effects with the Bluetooth module from a smartphone. I am wiring up a custom deck lighting scheme, and it would really be a cool effect to be able to swap different effects without plugging in to the arduino. Is there any place online that has sketches posted that I could just upload and try? The examples that came with the library are lacking in the amount of them department. Any help from anybody would greatly be appreciated. Thanks.

I shamelessly squirreled this example away from some time back. This might work for you.

For a partial set of pixels…

uint8_t bottomrow[NUM_ARMS] = {10,20,30,40,50,60 };
uint8_t nextbottomrow[NUM_ARMS] = {9,19,29,39,49,59 };

// set all the outermost leds to white, and next outermost to blue
for(int i = 0; i < NUM_ARMS; i++) {
leds[bottomrow[i]] = CRGB::White;
leds[nextbottomrow[i]] = CRGB::Blue;

Check this for Android->BT->Arduino->FastLED

or this one → TKJ Electronics » Bluetooth controlled RGB light strip

@marmil now, I tried adapting this. But like I said I am new to this type of coding and FastLED. Where is each of those codes being inserted? The void setup? The loop? And can u rename bottomrow and nextbottomrow?

Oh yes, certainly rename with variable names that make much more sense to your project! Sorry if that was confusing.
The variable decorations would go in the top part of your program where you’ve defined other variables. The for loop would go in you main program somewhere.

Post your code to http://pastebin.com if you’re still stuck so we can further assist.

@marmil Ok, so i tried all that… Here is the code, plus a bit of things i am playing with that are commented. dont worry about them so much… let me know if u see what im dong. im runing a strip of 5 WS2812B’s just to get the programming to work… Then ill implement it to bigger projects… thanks for your help!

@marmil http://pastebin.com/UGfEZeTt

I see a few things that need to be changed. Also, that original example I provided is still throwing you off since you didn’t know the context if where that came from. If you’re interested see here:

In the case of that example, the number of pixels in bottomrow and nextbottomrow were the same. In the example you’re putting together your groups don’t have the same number of LEDs, therefore they should probably each be defined separately. Add these lines defining the number of pixels in each of your custom groups.

#define NUM_RAILA 3
#define NUM_CAPS 2

Then, this line in your code:
uint8_t raila[NUM_ARMS] = {1,3,5 };
shouldn’t have a 5 in it since you’ve defined NUM_LEDS to be 5 and only have leds[0] through leds[4]. For this example let’s change that line to:
uint8_t raila[NUM_RAILA] = {0,1,3 };

and also change:
uint8_t caps[NUM_ARMS] = {2,4 };
uint8_t caps[NUM_CAPS] = {2,4 };

Ok, we’ve defined how many pixels are in each custom group, and they have valid pixel index numbers. Now you should be able to do something like this down in your main loop!

for (int i = 0; i < NUM_RAILA; i++) {
leds[raila[i]] = CRGB::White;
for (int i = 0; i < NUM_CAPS; i++) {
leds[raila[i]] = CRGB::Blue;

This should set the group of RAILA pixels to white and the CAPS pixels to blue.

Wow I appreciate your help. That will save me a lot of work when changing the colors on my deck lighting. Thanks so much.

You have some custom groups working in an example now?

I’m looking forward to video of a FastLED deck. :slight_smile:

@marmil Well, after messing with this for a few hours today, i am very close to having my code accepted and written. If u can Mark, take another look at my code and tell me if u see a problem. Commented is the exact code that you sent me, and it gave me all kinds of errors. I looked through it and got it to only give me 2 errors:
deck.ino:24:1: error: expected unqualified-id before ‘{’ token
deck.ino:35:1: error: expected unqualified-id before ‘{’ token
here is the pastebin

It should work once you’ve carefully gone through your code and fixed all your opening and closing braces. It looks like you might have moved some of the braces in the code I provided so some are in the wrong place and some missing now. Review how “for” loops use them, and also note that the main loop has an opening and closing brace as well. This is part of basic C coding so you’re going to have to learn this. Look at some basic Arduino sketches and FastLED examples some more and have another go at it. :slight_smile:

I just took a break, and figured it out almost instantly after revisiting it. Thanks for all your help. I greatly appreciate it!