James_sfx

Multiple Strips In One Array

Jul 25th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. // MultipleStripsInOneArray - 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 three
  3. // different pins, each strip will be referring to a different part of the single led array
  4.  
  5. #include "FastLED.h"
  6.  
  7. #define NUM_STRIPS 12
  8. #define NUM_LEDS_PER_STRIP 84
  9. #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
  10.  
  11. CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
  12.  
  13.  
  14. void setup() {
  15.  
  16. // tell FastLED there's 60 NEOPIXEL leds on pin 10, starting at index 0 in the led array
  17. FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP);
  18.  
  19. // tell FastLED there's 60 NEOPIXEL leds on pin 11, starting at index 60 in the led array
  20. FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  21.  
  22. // tell FastLED there's 60 NEOPIXEL leds on pin 12, starting at index 120 in the led array
  23. FastLED.addLeds<NEOPIXEL, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  24.  
  25. FastLED.addLeds<NEOPIXEL, 5>(leds, 0, NUM_LEDS_PER_STRIP);
  26.  
  27. FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  28.  
  29. FastLED.addLeds<NEOPIXEL, 7>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  30.  
  31.  
  32.  
  33.  
  34. FastLED.addLeds<NEOPIXEL, 8>(leds, 0, NUM_LEDS_PER_STRIP);
  35.  
  36. FastLED.addLeds<NEOPIXEL, 9>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  37.  
  38. FastLED.addLeds<NEOPIXEL, 10>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  39.  
  40. FastLED.addLeds<NEOPIXEL, 11>(leds, 0, NUM_LEDS_PER_STRIP);
  41.  
  42. FastLED.addLeds<NEOPIXEL, 12>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  43.  
  44.  
  45.  
  46.  
  47. FastLED.addLeds<NEOPIXEL, 12>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  48.  
  49.  
  50. }
  51.  
  52. void loop() {
  53. for(int i = 0; i < NUM_LEDS; i++) {
  54. leds[i] = CRGB::Red;
  55. FastLED.show();
  56. leds[i] = CRGB::Black;
  57. delay(100);
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment