FastLED 3.7.8
Loading...
Searching...
No Matches
MirroringSample.ino
Go to the documentation of this file.
1
4
5// MirroringSample - 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 four
7// different pins, and show the same thing on all four of them, a simple bouncing dot/cyclon type pattern
8
9#include <FastLED.h>
10
11#define NUM_LEDS_PER_STRIP 60
12CRGB leds[NUM_LEDS_PER_STRIP];
13
14// For mirroring strips, all the "special" stuff happens just in setup. We
15// just addLeds multiple times, once for each strip
16void setup() {
17 // tell FastLED there's 60 NEOPIXEL leds on pin 4
18 FastLED.addLeds<NEOPIXEL, 4>(leds, NUM_LEDS_PER_STRIP);
19
20 // tell FastLED there's 60 NEOPIXEL leds on pin 5
21 FastLED.addLeds<NEOPIXEL, 5>(leds, NUM_LEDS_PER_STRIP);
22
23 // tell FastLED there's 60 NEOPIXEL leds on pin 6
24 FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS_PER_STRIP);
25
26 // tell FastLED there's 60 NEOPIXEL leds on pin 7
27 FastLED.addLeds<NEOPIXEL, 7>(leds, NUM_LEDS_PER_STRIP);
28}
29
30void loop() {
31 for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
32 // set our current dot to red
33 leds[i] = CRGB::Red;
34 FastLED.show();
35 // clear our current dot before we move on
36 leds[i] = CRGB::Black;
37 delay(100);
38 }
39
40 for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) {
41 // set our current dot to red
42 leds[i] = CRGB::Red;
43 FastLED.show();
44 // clear our current dot before we move on
45 leds[i] = CRGB::Black;
46 delay(100);
47 }
48}
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:21
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:59
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition FastLED.cpp:47
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:131
@ Red
Definition crgb.h:580
@ Black
Definition crgb.h:468
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:25