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.

Because it doesn't really work that way. You're just checking to see how long it has been since something happened. Sometimes that something is the last time you were doing the same thing. Sometimes that time was when some other thing happened. Either way, when you record a value to whatever your equivalent of "previousMillis" in the Blink Without Delay example that is the time you saved and you can compare any given time against that to see how long it has been.

Sometimes you're timing off of multiple events, so you have a number of variables to keep track of the last time a number of different things happened. But you're still just recording the last time you did something and comparing to the current time to see how long it has been since then. There's no real trick to it.

|| | ||| | || | || ~Woodstock

Please do not PM with technical questions or comments. Keep Arduino stuff out on the boards where it belongs.

The issue is that I have been able to find nothing about millis() within millis(

That is because if you do something based on the time given by millis, and then in that function you do things based on the time you in effect have the same sort of blocking code that a delay would give you.The point of using millis() is that you constantly check, at the top level, if it is time to do any of your tasks. So every time round the loop you check for all things weather they happen ever couple of milliseconds or every couple of minutes or hours.

What you actually want to do is perfectly possible, if you code it right.

The point of using millis() is that you constantly check, at the top level

Okay, I think I understand what you mean. So I'm just creating one "clock" and it keeps track of everything? So it will check the time and blink the lights every 50-100 ms and while checking the time if it ever gets to 1minute, will shut off the first light of the ten, then the same at two minutes and on and on? I think I understand the concept, but the code must be very confusing for something like that.

Not quite, you are using the millis() function as your clock and you have a whole bunch of variables that tell you when the next thing is going to happen. You use these variables to check if it is time to do that task or not.

The tasks are simply functions that do one step of a process and then return quickly.

Wow, that's an amazing resource, thanks for putting that together! I've gone over it and I think I'm ready to try my hand at what I need for the timing. The only thing that confuses me is that everyone seems to show these examples with leds on their own output, as opposed to an led strip. How would I substitute that?

Yeah, that's what I was going for. I'm working on an example with just a few lights blinking. I figure once I have that I can just increase the speed to to get a flicker then worry about the countdown. I've got some sample lights broken into arrays, and I've got the the arrays working in the loop, but for some reason they aren't moving from blue to red every three seconds, but just staying one color and then flashing the other color for like a nanosecond. I'm probably missing something obvious, but here's where it is:

if it is time update last time that you updated the strip set the strip's leds show the ledsendif

Okay, thanks for the advice. I realize now that my last code was blinking for a nanosecond because I wasn't toggling between two colors, just showing one and replacing it for a split second. I've fiddled for a few hours and I think I've got the flicker going. Though it does one light at a time, is that normal? I thought it would "blink" each array rather than going light by light in each array. Perhaps I've made a mistake in the code, though I do like the random feeling of the effect. Here's what I've got:

It's just about there. The only issue is, as it turns each light off in the countdown, the lights that are still blinking change their blink rate and it becomes almost too fast to see when just a few lights are left. I'm guessing it has something to do with the array because if I do something like this:

It blinks all lights at the same speed no matter how many are on or off. Is it possible to combine those ideas? To have all lights blinking predictably while the countdown does its work? I figure then you could "randomize" the blink with a variable so that while it may appear random, it doesn't become completely wonky as the lights start to shut off. Or maybe it's just not possible. Either way, thanks for the help!

The same when you set lastMillis, you use an index number to show what value in the array to use. In this case it is i the loop variable.

You did it! All the LEDs blink at the same rate now. But for some reason they start the loop blinking, then, after the first light shuts off, they freeze and are just lit one color, then the next light shuts off, and they blink again, then next, they freeze, next they blink, etc. Somehow the loop to shut off a light every 6 seconds seems to be toggling the loop of blinks with each interval -- if that makes any sense.