Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ArrayOfLedArrays with strips of different length test
- // Marc Miller, Apr 2016
- //---------------------------------------------------------------
- #include "FastLED.h"
- #define LED_TYPE NEOPIXEL
- #define NUM_STRIPS 6 // Total number of strips
- #define NUM_LEDS0 11 // Specify length of each strip
- #define NUM_LEDS1 13
- #define NUM_LEDS2 17
- #define NUM_LEDS3 20
- #define NUM_LEDS4 21
- #define NUM_LEDS5 23
- #define BRIGHTNESS 20
- #define FRAMES_PER_SECOND 240
- //etc.
- CRGB leds[NUM_STRIPS][NUM_LEDS0 + NUM_LEDS1 + NUM_LEDS2 + NUM_LEDS3 + NUM_LEDS4 + NUM_LEDS5]; // Add all together here
- uint8_t stripLength; // Used to store a strip length.
- uint8_t gHue = 0;
- //---------------------------------------------------------------
- void setup() {
- Serial.begin(115200); // Allows serial monitor output (check baud rate)
- delay(3000);
- FastLED.addLeds<LED_TYPE, 6>(leds[0], NUM_LEDS0); // Assign data pins
- FastLED.addLeds<LED_TYPE, 9>(leds[1], NUM_LEDS1);
- FastLED.addLeds<LED_TYPE, 10>(leds[2], NUM_LEDS2);
- FastLED.addLeds<LED_TYPE, 11>(leds[3], NUM_LEDS3);
- FastLED.addLeds<LED_TYPE, 12>(leds[4], NUM_LEDS4);
- FastLED.addLeds<LED_TYPE, 13>(leds[5], NUM_LEDS5);
- //etc.
- FastLED.setBrightness( BRIGHTNESS );
- }
- //---------------------------------------------------------------
- void loop() {
- for(uint8_t x = 0; x < NUM_STRIPS; x++) {
- stripLength = getStripLength(x);
- fill_rainbow( leds[x], stripLength, millis()/2, 256/stripLength );
- }
- FastLED.show();
- }//end main loop
- //-----function to return strip length-----
- uint8_t getStripLength(uint8_t stripNumber){
- uint8_t L;
- if (stripNumber == 0) { L = NUM_LEDS0; }
- if (stripNumber == 1) { L = NUM_LEDS1; }
- if (stripNumber == 2) { L = NUM_LEDS2; }
- if (stripNumber == 3) { L = NUM_LEDS3; }
- if (stripNumber == 4) { L = NUM_LEDS4; }
- if (stripNumber == 5) { L = NUM_LEDS5; }
- //etc.
- //Serial.print("stripNumber ");
- //Serial.print(stripNumber);
- //Serial.print(" = ");
- //Serial.println(L);
- return L;
- }
Advertisement
Add Comment
Please, Sign In to add comment