Advertisement
atuline

blur

Aug 23rd, 2014
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.49 KB | None | 0 0
  1. // blur
  2. //
  3. // By: James Caruthers
  4. // Modified by: Andrew Tuline
  5. //
  6. // Date: Aug, 2014
  7. //
  8.  
  9.  
  10. #include <FastLED.h>                                           // FastLED library
  11.  
  12. #define LED_DT 12                                              // Data pin
  13. #define LED_CK 11
  14. #define NUM_LEDS 24                                            // Number of LED's
  15. #define COLOR_ORDER BGR                                        // Change the order as necessary
  16. #define LED_TYPE APA102                                        // What kind of strip are you using?
  17. #define BRIGHTNESS  64                                         // How bright do we want to go
  18.  
  19. struct CRGB leds[NUM_LEDS];                                    // Initializxe our array
  20. struct CRGB temp[NUM_LEDS];                                    // Initializxe our array
  21.  
  22. int thisdelay = 20;                                            // A delay value for the sequence(s)
  23.  
  24.  
  25. void setup() {
  26.   Serial.begin(57600);
  27.   LEDS.addLeds<LED_TYPE, LED_DT, LED_CK, COLOR_ORDER>(leds, NUM_LEDS);
  28.   FastLED.setBrightness(BRIGHTNESS);
  29. } // setup()
  30.  
  31. void loop () {
  32.   blur();
  33.   LEDS.show();                          // FastLED display
  34.   delay(thisdelay);                     // Standard delay
  35. } // loop()
  36.  
  37.  
  38. void blur() {
  39.   for(int b = 0; b < 16; b++) {
  40.     for(int x = 0; x < NUM_LEDS; x++) {
  41.       temp[x] = leds[x] + (leds[(((x-1)%NUM_LEDS)+NUM_LEDS)%NUM_LEDS]%10) + (leds[(x+1)%NUM_LEDS]%10);
  42.     }
  43.     memcpy8(leds, temp, sizeof(leds));
  44.   }
  45.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement