FastLED 3.10.6
Loading...
Searching...
No Matches
MultipleStripsInOneArray.ino
// @filter: (board is not ATtiny1604)
// MultipleStripsInOneArray - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
// using multiple controllers. In this example, we're going to set up three NEOPIXEL strips on three
// different pins, each strip will be referring to a different part of the single led array
//
// The segments are equal-sized here only to keep the arithmetic readable. Each
// addLeds() call takes its own offset and its own length, so unequal segments
// work just as well -- see MultiArrays.ino for a mixed-length example.
#include <FastLED.h>
#define NUM_STRIPS 3
#if FL_PLATFORM_HAS_TINY_MEMORY
// Keep three independently addressed segments within 512 B SRAM.
#define NUM_LEDS_PER_STRIP 4
#else
#define NUM_LEDS_PER_STRIP 60
#endif
#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
// For mirroring strips, all the "special" stuff happens just in setup. We
// just addLeds multiple times, once for each strip
void setup() {
// Add the first strip at index 0.
FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP);
// Add the second strip after the first segment.
// Add the third strip after the second segment.
FastLED.addLeds<NEOPIXEL, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
}
void loop() {
for(int i = 0; i < NUM_LEDS; i++) {
FastLED.show();
delay(100);
}
}
CRGB leds[1]
void setup()
void loop()
#define 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:629
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517