Hi, I'm very new to Arduino in general, but I really want to create a code for my LED strip. The LED strip has individually addressable LED's with LED type WS2811.
I'm trying to make the LED's do a starting sequence when I put them on, when the starting sequence is over I want the LED's to constantly loop through the second sequence without going back to the first.
I have tried messing with the code, but since I'm a beginner that didn't make it much better. Could anyone help me out on this?
#include <FastLED.h>
FASTLED_USING_NAMESPACE
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define DATA_PIN 3
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS 90
CRGB leds[NUM_LEDS];
#define BRIGHTNESS 200
#define FRAMES_PER_SECOND 120
void setup() {
delay(3000);
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
//FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
}
// --------------------------(patterns)-----------------------------
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = { confetti,sinelon };
uint8_t gCurrentPatternNumber = 0;
uint8_t gHue = 0;
void loop()
{
gPatterns[gCurrentPatternNumber]();
FastLED.show();
FastLED.delay(1000/FRAMES_PER_SECOND);
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
EVERY_N_SECONDS( 10 ) { nextPattern(); }
}
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
void nextPattern()
{
gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}
void confetti()
{
// flicker
fadeToBlackBy( leds, NUM_LEDS, 100);
int pos = random16(NUM_LEDS);
leds[pos] += CHSV( gHue + random8(64), 35, 255);
}
void sinelon()
{
// yellow to red
fadeToBlackBy( leds, NUM_LEDS, 1);
int pos = beatsin16( 15, 0, NUM_LEDS-0 );
leds[pos] += CHSV( 50, 255, 192);
}