Hey, Everyone. I'm working on a Proton Pack project and I've almost got the cyclotron lights how I like them.
I'm working with addressable RGB LEDs. I've got a pattern of four chasing lights, on for one second and fading for one second each. Currently each LED lights up and fades out and then the next one starts, but I'd like the illuminated period to overlap by one second.
Here's my sketch.
#include <FastLED.h>
#define NUM_LEDS 4 // Number of addressable LEDs
#define LED_PIN 6 // Pin connected to the data input of the first LED
#define DELAY_TIME 1000
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);
}
void loop() {
for (int i = 0; i < NUM_LEDS; i++) {
// Turn on the current LED for one second
leds[i] = CRGB::Red;
FastLED.show();
delay(DELAY_TIME);
// Fade out the current LED for one second
for (int brightness = 255; brightness >= 0; brightness--) {
leds[i].fadeToBlackBy(1);
leds[i].maximizeBrightness(brightness);
FastLED.show();
delay(DELAY_TIME / 255);
}
}
}
#include <FastLED.h>
#define NUM_LEDS 4 // Number of addressable LEDs
#define LED_PIN 6 // Pin connected to the data input of the first LED
#define DELAY_TIME 1000
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);
}
void loop() {
static int lastLED = NUM_LEDS - 1;
for (int i = 0; i < NUM_LEDS; i++) {
// Turn on the current LED for one second
leds[i] = CRGB::Red;
FastLED.show();
delay(DELAY_TIME);
// Fade out the current LED for one second
for (int brightness = 255; brightness >= 0; brightness--) {
leds[lastLED].fadeToBlackBy(1);
leds[lastLED].maximizeBrightness(brightness);
FastLED.show();
delay(DELAY_TIME / 255);
}
lastLED = i;
}
}