Hi Guys,
Hopefully someone can help me with this.
I am setting up a project so that when someone pushes a button a strip of UCS1903 Led lights up in a chase and then stays on.
I have it doing that, however I would like it to be able to fade in instead of snapping the pixels on.
How would I go about this?
#include <FastLED.h>
#define NUM_LEDS 250
#define DATA_PIN 4
CRGB leds[NUM_LEDS];
const int buttonPin = 2;
int buttonState = 0;
void setup() {
FastLED.addLeds<UCS1903B, DATA_PIN, RBG>(leds, NUM_LEDS);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
for(int dot = 0; dot < NUM_LEDS; dot++) {
leds[dot] = CRGB::Black;
FastLED.show();
// clear this led for the next time around the loop
leds[dot] = CRGB::Black;
//delay(20);
}
}
if (buttonState == LOW) {
for(int dot = 0; dot < NUM_LEDS; dot++) {
leds[dot] = CRGB::Gold;
FastLED.show();
// clear this led for the next time around the loop
//leds[dot] = CRGB::Gold;
delay(2);
}
}
}
Chivas_LED_Chase.ino (898 Bytes)