FastLED
3.10.6
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 three NEOPIXEL strips on three
9
// different pins, each strip will be referring to a different part of the single led array
10
//
11
// The segments are equal-sized here only to keep the arithmetic readable. Each
12
// addLeds() call takes its own offset and its own length, so unequal segments
13
// work just as well -- see MultiArrays.ino for a mixed-length example.
14
15
#include <FastLED.h>
16
17
#define NUM_STRIPS 3
18
#if FL_PLATFORM_HAS_TINY_MEMORY
19
// Keep three independently addressed segments within 512 B SRAM.
20
#define NUM_LEDS_PER_STRIP 4
21
#else
22
#define NUM_LEDS_PER_STRIP 60
23
#endif
24
#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
25
26
CRGB
leds
[
NUM_STRIPS
*
NUM_LEDS_PER_STRIP
];
27
28
// For mirroring strips, all the "special" stuff happens just in setup. We
29
// just addLeds multiple times, once for each strip
30
void
setup
() {
31
// Add the first strip at index 0.
32
FastLED
.addLeds<NEOPIXEL, 2>(
leds
, 0,
NUM_LEDS_PER_STRIP
);
33
34
// Add the second strip after the first segment.
35
FastLED
.addLeds<NEOPIXEL, 3>(
leds
,
NUM_LEDS_PER_STRIP
,
NUM_LEDS_PER_STRIP
);
36
37
// Add the third strip after the second segment.
38
FastLED
.addLeds<NEOPIXEL, 4>(
leds
, 2 *
NUM_LEDS_PER_STRIP
,
NUM_LEDS_PER_STRIP
);
39
40
}
41
42
void
loop
() {
43
for
(
int
i = 0; i <
NUM_LEDS
; i++) {
44
leds
[i] =
CRGB::Red
;
45
FastLED
.show();
46
leds
[i] =
CRGB::Black
;
47
delay(100);
48
}
49
}
leds
CRGB leds[1]
Definition
AnalogOutput.ino:26
setup
void setup()
Definition
AnalogOutput.ino:58
loop
void loop()
Definition
AnalogOutput.ino:47
NUM_LEDS
#define NUM_LEDS
Definition
Animartrix.ino:79
NUM_LEDS_PER_STRIP
#define NUM_LEDS_PER_STRIP
Definition
ArrayOfLedArrays.ino:19
NUM_STRIPS
#define NUM_STRIPS
Definition
ArrayOfLedArrays.ino:14
FastLED
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition
FastLED.cpp.hpp:90
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
fl::CRGB::Red
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition
crgb.h:629
fl::CRGB::Black
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition
crgb.h:517
examples
Multiple
MultipleStripsInOneArray
MultipleStripsInOneArray.ino
Generated on Sun Oct 4 2026 23:08:59 for FastLED by
1.13.2