forked from marmilicious/FastLED_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CRGBSet_example.ino
36 lines (28 loc) · 1.05 KB
/
CRGBSet_example.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Marc Miller, Jan 2016
#include "FastLED.h"
#define NUM_LEDS 32
//CRGB leds[NUM_LEDS]; // Not using this. Using CRGBArray instead.
CRGBArray<NUM_LEDS> leds;
CRGBSet partA(leds(6,9)); // Define custom pixel range with a name.
CRGBSet partB(leds(22,25)); // Define custom pixel range with a name.
CHSV colorOne(0,222,255); // Define a custom color.
CHSV colorTwo(82,222,255); // Define a custom color.
//---------------------------------------------------------------
void setup() {
FastLED.addLeds<LPD8806, 11, 13, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(255);
}
//---------------------------------------------------------------
void loop()
{
fill_rainbow(leds, NUM_LEDS, millis()/10); // fill strip with moving rainbow.
leds.fadeToBlackBy(230); // fade the whole strip down some.
partA = colorOne; // set partA pixel color.
partB = colorTwo; // set partB pixel color.
FastLED.show();
EVERY_N_SECONDS(4){ // Swaps the two custom colors every four seconds.
CHSV temp = colorOne;
colorOne = colorTwo;
colorTwo = temp;
}
}