PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MirroringSample.ino 1.4KB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // MirroringSample - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
  2. // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on four
  3. // different pins, and show the same thing on all four of them, a simple bouncing dot/cyclon type pattern
  4. #include <FastLED.h>
  5. #define NUM_LEDS_PER_STRIP 60
  6. CRGB leds[NUM_LEDS_PER_STRIP];
  7. // For mirroring strips, all the "special" stuff happens just in setup. We
  8. // just addLeds multiple times, once for each strip
  9. void setup() {
  10. // tell FastLED there's 60 NEOPIXEL leds on pin 4
  11. FastLED.addLeds<NEOPIXEL, 4>(leds, NUM_LEDS_PER_STRIP);
  12. // tell FastLED there's 60 NEOPIXEL leds on pin 5
  13. FastLED.addLeds<NEOPIXEL, 5>(leds, NUM_LEDS_PER_STRIP);
  14. // tell FastLED there's 60 NEOPIXEL leds on pin 6
  15. FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS_PER_STRIP);
  16. // tell FastLED there's 60 NEOPIXEL leds on pin 7
  17. FastLED.addLeds<NEOPIXEL, 7>(leds, NUM_LEDS_PER_STRIP);
  18. }
  19. void loop() {
  20. for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
  21. // set our current dot to red
  22. leds[i] = CRGB::Red;
  23. FastLED.show();
  24. // clear our current dot before we move on
  25. leds[i] = CRGB::Black;
  26. delay(100);
  27. }
  28. for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) {
  29. // set our current dot to red
  30. leds[i] = CRGB::Red;
  31. FastLED.show();
  32. // clear our current dot before we move on
  33. leds[i] = CRGB::Black;
  34. delay(100);
  35. }
  36. }