Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 7th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <FastLED.h>
  2.  
  3. #define LED_PIN     6
  4. #define LED_PIN_2   7
  5. #define NUM_LEDS    57
  6. #define NUMB_LEDS   40
  7. #define BRIGHTNESS  255
  8. #define BRIGHTNESS2 55
  9. #define LED_TYPE    WS2812
  10. #define COLOR_ORDER GRB
  11. CRGB leds[NUM_LEDS];
  12. CRGB leds2[NUMB_LEDS];
  13.  
  14. #define UPDATES_PER_SECOND 100
  15.  
  16. CRGBPalette16 currentPalette;
  17. TBlendType    currentBlending;
  18.  
  19. extern CRGBPalette16 LavaColors;
  20. extern const TProgmemPalette16 LavaColors_p PROGMEM;
  21.  
  22.  
  23. void setup() {
  24.     delay( 3000 ); // power-up safety delay
  25.     FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  26.     FastLED.setBrightness(  BRIGHTNESS );
  27.     FastLED.addLeds<LED_TYPE, LED_PIN_2>(leds2, NUMB_LEDS).setCorrection (TypicalLEDStrip);
  28.     FastLED.setBrightness(  BRIGHTNESS2 );
  29.    
  30.     currentPalette = LavaColors_p;
  31.     currentBlending = LINEARBLEND;
  32. }
  33.  
  34.  
  35. void loop()
  36. {
  37.    
  38.     static uint8_t startIndex = 0;
  39.     startIndex = startIndex + 1; /* motion speed */
  40.    
  41.     FillLEDsFromPaletteColors( startIndex);
  42.    
  43.     FastLED.show();
  44.     FastLED.delay(1000 / UPDATES_PER_SECOND);
  45.  
  46.     for(int i = 0; i < NUMB_LEDS; i++)
  47.     leds2[i] = 0xffffff;
  48. }
  49.  
  50. void FillLEDsFromPaletteColors( uint8_t colorIndex)
  51. {
  52.     uint8_t brightness = 255;
  53.    
  54.     for( int i = 0; i < NUM_LEDS; i++) {
  55.         leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
  56.         colorIndex += 3;
  57.     }
  58. }
  59.  
  60.  
  61. // There are several different palettes of colors demonstrated here.
  62. //
  63. // FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
  64. // OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top