diff options
Diffstat (limited to 'Библиотеки/FastLED-master/examples/Multiple/MirroringSample/MirroringSample.ino')
-rw-r--r-- | Библиотеки/FastLED-master/examples/Multiple/MirroringSample/MirroringSample.ino | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Библиотеки/FastLED-master/examples/Multiple/MirroringSample/MirroringSample.ino b/Библиотеки/FastLED-master/examples/Multiple/MirroringSample/MirroringSample.ino new file mode 100644 index 0000000..39d748b --- /dev/null +++ b/Библиотеки/FastLED-master/examples/Multiple/MirroringSample/MirroringSample.ino @@ -0,0 +1,44 @@ +// MirroringSample - 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 four NEOPIXEL strips on four +// different pins, and show the same thing on all four of them, a simple bouncing dot/cyclon type pattern + +#include "FastLED.h" + +#define NUM_LEDS_PER_STRIP 60 +CRGB leds[NUM_LEDS_PER_STRIP]; + +// For mirroring strips, all the "special" stuff happens just in setup. We +// just addLeds multiple times, once for each strip +void setup() { + // tell FastLED there's 60 NEOPIXEL leds on pin 4 + FastLED.addLeds<NEOPIXEL, 4>(leds, NUM_LEDS_PER_STRIP); + + // tell FastLED there's 60 NEOPIXEL leds on pin 5 + FastLED.addLeds<NEOPIXEL, 5>(leds, NUM_LEDS_PER_STRIP); + + // tell FastLED there's 60 NEOPIXEL leds on pin 6 + FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS_PER_STRIP); + + // tell FastLED there's 60 NEOPIXEL leds on pin 7 + FastLED.addLeds<NEOPIXEL, 7>(leds, NUM_LEDS_PER_STRIP); +} + +void loop() { + for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { + // set our current dot to red + leds[i] = CRGB::Red; + FastLED.show(); + // clear our current dot before we move on + leds[i] = CRGB::Black; + delay(100); + } + + for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) { + // set our current dot to red + leds[i] = CRGB::Red; + FastLED.show(); + // clear our current dot before we move on + leds[i] = CRGB::Black; + delay(100); + } +} |