Help with cycling multiple LED states within modified Blink without delay

Hi there,

I recently undertook an arduino project for uni. I'm a total novice when it comes to anything arduino, I made a couple of posts regarding project guidance and have made a little progress, however there are still some pretty big gaps in my knowledge. I've tried to follow the advice I've received as best I can but have had trouble a little with various bits, and understanding basic programming language...

So here it is:

I am making device which requires 2 lots of 12 LED's (I refer to them as banks) to be flashing at varying frequencies- for example:

Bank 1 might flash HIGH for 250, then LOW 250 with an interval of 400

while

Bank 2 might flash HIGH for 075, then LOW for 075, with an interval of 200.

This would go for 30 seconds, then both banks would change to a different frequency of flashes per second for another 30 seconds. And so on, for a total run time of 3 minutes.

I've worked out the wiring for the LED's, I'm using a MEGA and have the 2 banks running off PWM pins 11 and 12.

I found some modified 'Blink without delay code' off this forum and was able to tweak it ever so slightly so that I have a group of intervals which can be called. My problem is however, that I'm not sure how to get the loop to run through them, instead of just having one assigned interval for each pin.

I'm aware there are ways of using a 'for' or 'while' command ? do set a kind of timer or counter in order to keep track of how many times a loop may have run, but have no idea how to write this into the existing code..

If anyone could point me to the right solution, or even tack a little tweaking of their own onto this it would be an immense help!
Thank you in advance!

here is the code I currently have:

#define OFFTIME 1000
#define ONTIME 1000
unsigned long interval = 1000;

#define OFFTIME1 250
#define ONTIME1 300
unsigned long interval1 = 250;

#define OFFTIME2 250
#define ONTIME2 300
unsigned long interval2 = 250;

#define OFFTIME3 900
#define ONTIME3 10
unsigned long interval3 = 50;

const int ledPin1 = 12;
int ledState = LOW;
long previousMillis1 = 0;

const int ledPin2 = 11;
int ledState1 = LOW;
long previousMillis2 = 0;

void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);

}

void loop()
{

unsigned long currentMillis1 = millis();

if (currentMillis1 - previousMillis1 > interval3)
{
previousMillis1 = currentMillis1;

if (ledState == LOW)
{
ledState = HIGH;
interval = ONTIME;
}
else
{
ledState = LOW;
interval = OFFTIME;
}
digitalWrite(ledPin1, ledState);
}

unsigned long currentMillis2 = millis();

if (currentMillis2 - previousMillis2 > interval2)
{
previousMillis2 = currentMillis2;

if (ledState1 == LOW)
{
ledState1 = HIGH;
interval = ONTIME;
}
else
{
ledState1 = LOW;
interval = OFFTIME;
}
digitalWrite(ledPin2, ledState1);
}

}

Look at the MultiBlink example in the Playground.

What you may want to do is defined 2 data tables and swap over which one you use to get the different patterns you are lookng for.