FastLED
3.10.6
Loading...
Searching...
No Matches
ArrayOfLedArrays.ino
Go to the documentation of this file.
1
4
5
// @filter: (board is not ATtiny1604)
6
7
// ArrayOfLedArrays - 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 getting its own CRGB array to be played with, only this time they're going
10
// to be all parts of an array of arrays.
11
12
#include <FastLED.h>
13
14
#define NUM_STRIPS 3
15
#if FL_PLATFORM_HAS_TINY_MEMORY
16
// Three 60-pixel arrays alone need 540 B, more than an ATtiny85 owns.
17
#define NUM_LEDS_PER_STRIP 4
18
#else
19
#define NUM_LEDS_PER_STRIP 60
20
#endif
21
CRGB
leds
[
NUM_STRIPS
][
NUM_LEDS_PER_STRIP
];
22
23
// For mirroring strips, all the "special" stuff happens just in setup. We
24
// just addLeds multiple times, once for each strip
25
void
setup
() {
26
// Add the first NEOPIXEL strip on pin 2.
27
FastLED
.addLeds<NEOPIXEL, 2>(
leds
[0],
NUM_LEDS_PER_STRIP
);
28
29
// Add the second NEOPIXEL strip on pin 3.
30
FastLED
.addLeds<NEOPIXEL, 3>(
leds
[1],
NUM_LEDS_PER_STRIP
);
31
32
// Add the third NEOPIXEL strip on pin 4.
33
FastLED
.addLeds<NEOPIXEL, 4>(
leds
[2],
NUM_LEDS_PER_STRIP
);
34
35
}
36
37
void
loop
() {
38
// This outer loop will go over each strip, one at a time
39
for
(
int
x
= 0;
x
<
NUM_STRIPS
;
x
++) {
40
// This inner loop will go over each led in the current strip, one at a time
41
for
(
int
i = 0; i <
NUM_LEDS_PER_STRIP
; i++) {
42
leds
[
x
][i] =
CRGB::Red
;
43
FastLED
.show();
44
leds
[
x
][i] =
CRGB::Black
;
45
delay(100);
46
}
47
}
48
}
leds
CRGB leds[1]
Definition
AnalogOutput.ino:26
setup
void setup()
Definition
AnalogOutput.ino:58
loop
void loop()
Definition
AnalogOutput.ino:47
NUM_LEDS_PER_STRIP
#define NUM_LEDS_PER_STRIP
Definition
ArrayOfLedArrays.ino:19
NUM_STRIPS
#define NUM_STRIPS
Definition
ArrayOfLedArrays.ino:14
x
int x
Definition
simple.h:92
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
ArrayOfLedArrays
ArrayOfLedArrays.ino
Generated on Sun Oct 4 2026 23:08:59 for FastLED by
1.13.2