FastLED 3.9.15
Loading...
Searching...
No Matches
MultipleStripsInOneArray.ino
Go to the documentation of this file.
1
4
5// @filter: (board is not ATtiny1604)
6
7// MultipleStripsInOneArray - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
8// using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on three
9// different pins, each strip will be referring to a different part of the single led array
10
11#include <FastLED.h>
12
13#define NUM_STRIPS 3
14#define NUM_LEDS_PER_STRIP 60
15#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
16
18
19// For mirroring strips, all the "special" stuff happens just in setup. We
20// just addLeds multiple times, once for each strip
21void setup() {
22 // tell FastLED there's 60 NEOPIXEL leds on pin 2, starting at index 0 in the led array
23 FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP);
24
25 // tell FastLED there's 60 NEOPIXEL leds on pin 3, starting at index 60 in the led array
26 FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
27
28 // tell FastLED there's 60 NEOPIXEL leds on pin 4, starting at index 120 in the led array
29 FastLED.addLeds<NEOPIXEL, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
30
31}
32
33void loop() {
34 for(int i = 0; i < NUM_LEDS; i++) {
35 leds[i] = CRGB::Red;
36 FastLED.show();
37 leds[i] = CRGB::Black;
38 delay(100);
39 }
40}
void setup()
void loop()
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
#define NUM_LEDS_PER_STRIP
#define NUM_STRIPS
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::CRGB CRGB
Definition crgb.h:25
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:622
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510