Created
October 30, 2017 04:21
-
-
Save marmilicious/f86b39d8991e1efcfd9fbd90dcdf751b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Fading up and down using fadeLightBy | |
//by Scott Kletzien | |
/* | |
Put together & tested by: | |
Scottie Digital | |
*/ | |
#include "FastLED.h" | |
#define NUM_LEDS 288 // # of LEDS in the strip | |
CRGB leds[NUM_LEDS]; | |
#define PIN 8 // Output Pin to Data Line on Strip | |
#define COLOR_ORDER GRB // I had to change this for my strip if your color is off then you know. | |
int fadeAmount = 5; // Set the amount to fade I usually do 5, 10, 15, 20, 25 etc even up to 255. | |
int brightness = 0; | |
void setup() | |
{ | |
FastLED.addLeds<WS2812B, PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); | |
} | |
void loop() | |
{ | |
for(int i = 0; i < NUM_LEDS; i++ ) | |
{ | |
leds[i].setRGB(0,255,250); // Set Color HERE!!! | |
leds[i].fadeLightBy(brightness); | |
} | |
FastLED.show(); | |
brightness = brightness + fadeAmount; | |
// reverse the direction of the fading at the ends of the fade: | |
if(brightness == 0 || brightness == 255) | |
{ | |
fadeAmount = -fadeAmount ; | |
} | |
delay(9); // This delay sets speed of the fade. I usually do from 5-75 but you can always go higher. | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment