How would I go about controlling the flashing of a pattern, as in sec.

How would I go about controlling the flashing of a pattern, as in sec. Between flashes?

Did you see this:

I’m probably missing your point but this question appears too simple.

My suggestion is also to slowly go through the blink and cylon sketches that came in the FastLED library examples.

When you understand what they do and how they do it you will automatically get your answer !!

Ok felt a bit guilty about my last comment and decided to give you a complete sketch that has the simplest flashing pattern.
You can of course modify it with your pattern of choice and play with the delays to your satisfaction…

#include “FastLED.h”
#define NUM_LEDS 30
#define DATA_PIN 8

int flash_duration = 100; // 100 milliseconds = 1/10th second
int time_between_flashes = 1000; // 1000 milliseconds = 1 second
CRGB leds[NUM_LEDS];
void setup(){
FastLED.addLeds<WS2811, DATA_PIN>(leds, NUM_LEDS);
}
void loop(){
fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.show();
delay(flash_duration);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
delay(time_between_flashes);
}

Thanks for the help. Im new to the arduino and am still getting used to C++. Thanks for the example especially, it definatly helps to see code more than explination sometimes.
(And dont feel guilty about the comment, its exactly what i would have said. :slight_smile: )

Hi @Johnny_Woods_Masamun ,

I’m glad that actually helped you as I really was not sure I understood your question.

Do not hesitate to ask for help again but next time you need to include more info as is specified above…

I usually do add more information to my questions, but i didnt know any other way to put it, and i was in a hurry when i wrote the question

Bunches of ways of skinning the cat. While there is nothing wrong with what JP posted, I would much rather have folks not use the delay() function as that will inevitably lead to the next set of problems of why their program appear to hang every second.

Use the builtin millis() timer instead:

volatile long lastRun = 0;
const uint16_t SECOND = 1000;

void loop() {
if (millis() - lastRun > SECOND) {
// do whatever
lastRun = millis();
}
}

The above will allow other commands to run while what’s in the if loop only runs every 1000 cycles, ish, it’s not exactly accurate. If you want accuracy, use an RTC.

It can be expanded to use multiple pauses without a single use of delay().