FastLED 3.9.15
Loading...
Searching...
No Matches
MultipleStripsInOneArray.ino
Go to the documentation of this file.
1
4
5// MultipleStripsInOneArray - 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 four NEOPIXEL strips on three
7// different pins, each strip will be referring to a different part of the single led array
8
9#include <FastLED.h>
10
11#define NUM_STRIPS 3
12#define NUM_LEDS_PER_STRIP 60
13#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
14
16
17// For mirroring strips, all the "special" stuff happens just in setup. We
18// just addLeds multiple times, once for each strip
19void setup() {
20 // tell FastLED there's 60 NEOPIXEL leds on pin 2, starting at index 0 in the led array
21 FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP);
22
23 // tell FastLED there's 60 NEOPIXEL leds on pin 3, starting at index 60 in the led array
25
26 // tell FastLED there's 60 NEOPIXEL leds on pin 4, starting at index 120 in the led array
28
29}
30
31void loop() {
32 for(int i = 0; i < NUM_LEDS; i++) {
33 leds[i] = CRGB::Red;
34 FastLED.show();
35 leds[i] = CRGB::Black;
36 delay(100);
37 }
38}
void setup()
void loop()
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
#define NUM_STRIPS
#define NUM_LEDS_PER_STRIP
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:138
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:611
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:499
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54