FastLED 3.9.7
Loading...
Searching...
No Matches
ArrayOfLedArrays.ino
Go to the documentation of this file.
1
4
5// ArrayOfLedArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
6// using multiple controllers. In this example, we're going to set up three NEOPIXEL strips on three
7// different pins, each strip getting its own CRGB array to be played with, only this time they're going
8// to be all parts of an array of arrays.
9
10#include <FastLED.h>
11
12#define NUM_STRIPS 3
13#define NUM_LEDS_PER_STRIP 60
14CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];
15
16// For mirroring strips, all the "special" stuff happens just in setup. We
17// just addLeds multiple times, once for each strip
18void setup() {
19 // tell FastLED there's 60 NEOPIXEL leds on pin 2
20 FastLED.addLeds<NEOPIXEL, 2>(leds[0], NUM_LEDS_PER_STRIP);
21
22 // tell FastLED there's 60 NEOPIXEL leds on pin 3
23 FastLED.addLeds<NEOPIXEL, 3>(leds[1], NUM_LEDS_PER_STRIP);
24
25 // tell FastLED there's 60 NEOPIXEL leds on pin 4
26 FastLED.addLeds<NEOPIXEL, 4>(leds[2], NUM_LEDS_PER_STRIP);
27
28}
29
30void loop() {
31 // This outer loop will go over each strip, one at a time
32 for(int x = 0; x < NUM_STRIPS; x++) {
33 // This inner loop will go over each led in the current strip, one at a time
34 for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
35 leds[x][i] = CRGB::Red;
36 FastLED.show();
37 leds[x][i] = CRGB::Black;
38 delay(100);
39 }
40 }
41}
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:45
central include file for FastLED, defines the CFastLED class/object
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
Definition FastLED.cpp:94
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition FastLED.cpp:79
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:135
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54
@ Red
Definition crgb.h:608
@ Black
Definition crgb.h:496