marmil

two strips two pins two patterns

Jan 22nd, 2021 (edited)
214
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // example for setting up two LED strings, each with their own
  2. // pin and CRGB array to allow a different pattern to run on each.
  3.  
  4. #include <FastLED.h>
  5.  
  6. #define NUM_LEDS_A 25
  7. #define NUM_LEDS_B 50
  8. CRGB ledsA[NUM_LEDS_A];
  9. CRGB ledsB[NUM_LEDS_B];
  10.  
  11.  
  12. void setup() {
  13.   FastLED.addLeds<WS2812, pinA, RGB>(ledsA, NUM_LEDS_A);
  14.   FastLED.addLeds<WS2812, pinB, RGB>(ledsB, NUM_LEDS_B);
  15. }
  16.  
  17.  
  18. void loop() {
  19.  
  20.   //some pattern for A
  21.   EVERY_N_MILLISECONDS(25) {
  22.     for(int i = 0; i < NUM_LEDS_A; i++) {
  23.       static uint8_t hueA;
  24.       ledsA[i] = CHSV(hueA, 200, 200);
  25.       hueA = hueA - 3;
  26.     }
  27.   }
  28.  
  29.   //some pattern for B
  30.   EVERY_N_MILLISECONDS(42) {
  31.     static unit8_t hueB;
  32.     fill_rainbow( ledsB, NUM_LEDS_B, hueB, 5);
  33.     hueB++;
  34.   }
  35.  
  36.   FastLED.show();  // update all pixels
  37.  
  38. }
RAW Paste Data