help with sequencing leds

Hi !

I need to turn on/off 10 leds with different periods of time sync with a start puse (digital input).
Example: led 1 ON from second 3 to second 5
led 2 ON from second 2 to second 7
and so on..
The program must be running 24/7. (overflows?)

Can you give me a hint where to start with this?

Regards.
GABO

I did something kind of like this. I used the random() command to choose the time between blinks. blink_delay = random(500, 4001); This gives a random number between 1/2 second (500ms) and 4 seconds (4000ms). If you must have a whole number, I used an array and then used random() to choose which one to blink. Initialize with this statement: const byte pwmPins [] = {3, 5, 6, 9, 10, 11}; and use the random choice like this: pwmPin = pwmPins [random (0, 6)];

Hope this will help get you started.

Can you give me a hint where to start with this?

Start by defining what your sequences can be in more detail.

What's the timing resolution? A second? Some fraction of a second?

How long can the sequence get (measured in terms of your fundamental time unit)? If, say, your resolution is 1 second, and the sequence can be 15 seconds long, it probably makes sense to describe it with a table that tells you which LEDs are on during each second.

Otoh, it you're measuring to a tenth of a second, and you want the sequence to last up to a minute, you should probably define it with a list of events, where each entry says "At time x, turn LED y on (or off)", because a tick-by-tick table would be too big.

Thank you all...

Talbot:
The project is :
Turn on/off a set of valves to control a process.
The time is in milliseconds, the period could be from 3000 seconds to 15000 the lapse that the led must be ON is from 10 milliseconds to 1 period.

I read the METRO library and seems to be the way...I'll make a try...

Question: Is there any issue with time overflows with the metro library ?

Regards...

GABO