Hi guys,
First off, thanks for already being so helpful! Just by reading posts on here I've learned how to use the led strip with my arduino UNO and I've coded a basic (but not for me!) function. So thanks.
Basically what I'm trying to do is create a little timer using the LED. So it starts with 10 leds on the strip lit, then every minute the next (first) in line shuts off. Here is what I have:
#include <FastLED.h>
#define NUM_LEDS 50
#define DATA_PIN 6
#define COLOR_ORDER RGB
CRGB leds[NUM_LEDS];
void setup() {
delay(2000);
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
// Turn the LED on
leds[0] = CRGB(255,50,0);
FastLED.show();
leds[3] = CRGB(255,50,0);
FastLED.show();
leds[5] = CRGB(255,50,0);
FastLED.show();
leds[9] = CRGB(255,50,0);
FastLED.show();
leds[11] = CRGB(255,50,0);
FastLED.show();
leds[14] = CRGB(255,50,0);
FastLED.show();
leds[18] = CRGB(255,50,0);
FastLED.show();
leds[21] = CRGB(255,50,0);
FastLED.show();
leds[24] = CRGB(255,50,0);
FastLED.show();
leds[27] = CRGB(255,50,0);
FastLED.show();
}
void loop() {
delay(60000);
leds[0] = CRGB(0,0,0);
FastLED.show();
delay(60000);
leds[3] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[5] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[9] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[11] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[14] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[18] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[21] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[24] = CRGB(0,0,0);
FastLED.show();delay(60000);
leds[27] = CRGB(0,0,0);
}
This is honestly good enough. But it's supposed to be like a little fire where a bit of the flame goes out every minute. So I thought it would look amazing if it flickered. I know you can make a "flickering flame" effect by blinking the led quickly and did so. But when I blink them using delay, that of course messes with the delay countdown I was using. I obviously can't have both.
So then I read up on arrays and using millis() to avoid such conflict. The issue is that I have been able to find nothing about millis() within millis() -- if that makes any sense. Like, I was thinking (and I'm sorry if this is dumb) that the best thing to do would be to have the lights I want on in an array, then "flicker" them using millis() to turn them on and off every 50-100ms, then have millis() turn off the next light in the array every minute. Does that make sense? Or is it even possible? If I'm using the millis() to flicker the ten lights, can millis() also be turning them off in a pattern, or is that going to end in disaster?
Anyway, I hope that made sense. I just wanted to get an idea of whether or not what I'm trying to do (flicker effect + count down) is even possible or if I'm wasting my time. And if it is possible, whether little dumb me is on the right track, or if there is a way better way to do this.
Thanks!