What's the best way to address a specific range of LEDs in a strip

What’s the best way to address a specific range of LEDs in a strip for a specific amount of time? Say I want to do
leds[5 through 10] = CRGB:: white for x number of milliseconds
Then leds[5 through 10] = CRGB:: black for x number of milliseconds.
I’m trying to make some Orange and white strobing lights in specific places in some LED strips.

Maybe not the best way, but here’s one example that might give you ideas for using EVERY_N to toggle colors. Another thing would be to toggle a variable that is then checked elsewhere.
EVERY_N_MILLISECONDS (10) {
myToggle = !myToggle;
}

@marmil ok thank you! I’ll try some things out later tonight and see what I come up with.

@Kyle_Halvorson ​ I forgot to mention that if you use EVERY_N_MILLISECONDS_I then you could also have different on and off times if you wanted to. Just update the http://timingObj.setPeriod whenever you toggle the color.

Ok that makes sense, thank you!

I can’t seem to figure out why this won’t toggle, do I have something in the wrong place? Trying to get a general idea of how to “flash” it.
// Marc Miller, Jan 2016

#include “FastLED.h”
#define NUM_LEDS 44

//CRGB leds[NUM_LEDS]; // Not using this. Using CRGBArray instead.
CRGBArray<NUM_LEDS> leds;

CRGBSet partA(leds(0,22)); // Define custom pixel range with a name.
CRGBSet partB(leds(22,44)); // Define custom pixel range with a name.

CRGB colorA(242,75,0); // Define a custom color, Orange
CRGB colorTwo(255,255,255); // Define a custom color, White

boolean Atog = true;
//-------------------------------------------------------------
void setup() {
FastLED.addLeds<WS2812B, 9 ,GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(255);
}

//-------------------------------------------------------------
void loop()
{ EVERY_N_MILLISECONDS(500) {
Atog = !Atog;
}

if(Atog == true){
partA = colorOne;
}
if(Atog == false){
partA = CRGB (0, 0, 0);
}

partA = colorA;  // set partA pixel color.

//partB = colorTwo; // set partB pixel color.

FastLED.show();
//EVERY_N_MILLISECONDS(1500){ // Swaps the two custom colors.
// CRGB temp = colorOne;
// colorOne = colorTwo;
// colorTwo = temp;
//}
}

Every time through the loop, no matter what Atog is, you’re setting partA = colorA.

Also your part B’s last number is past the number of LEDs you’re using.

Figured it out,
partA = colorA; // set partA pixel color.
Shouldn’t have been there at all… Duh…

Also can you use http://gist.github.com for sharing code. Easier to read and line numbers can be referenced.

Oh right, because “0” is counted isn’t it? Should be
CRGBSet partB(leds(22,43));

Yeah, i’ll set up an account, Probably should’ve a while ago… I’ve needed it.

You don’t actually need an account, but you might as well so you can save and share stuff easily. :slight_smile: