Create Time Delay Between LED Sequences

I am trying to create a lightning and volcano effect. I want to put a delay of about 5 minutes between the lightning and volcano LED sequence. I’ve tried numerous things but no luck. Any suggestions?

// PUPROSE: simulate lighning and volcano explosion with multiple LEDs
//
//
//LIGHTNING
#define BETWEEN 2579
#define DURATION 43
#define TIMES 7

//VOLCANO
#define BETWEENV 1200
#define DURATIONV 80
#define TIMESV 10

#define LEDPIN12 12
#define LEDPIN13 13

unsigned long lastTime = 0;
int waitTime = 0;

void setup()
{
Serial.begin(115200);
Serial.println(“lightning 0.0”);

pinMode(LEDPIN12, OUTPUT);
pinMode(LEDPIN13, OUTPUT);
}

void loop()
{
if (millis() - waitTime > lastTime) // time for a new flash
{
// adjust timing params
lastTime += waitTime;
waitTime = random(BETWEEN);

for (int i=0; i< random(TIMES); i++)

{
// LIGHTNING
Serial.println(millis());
digitalWrite(LEDPIN13, HIGH);
delay(20 + random(DURATION));
digitalWrite(LEDPIN13, LOW);
delay(10);
}

{
// VOLCANO
Serial.println(millis());
digitalWrite(LEDPIN12, HIGH);
delay(20 + random(DURATIONV));
digitalWrite(LEDPIN12, LOW);
delay(10);

}
}
}

Five minutes = 300 seconds = 300000 milliseconds.
300000 milliseconds into a sixteen bit “int” doesn’t go.
Better use an unsigned long.

for (int i=0; i< random(TIMES); i++)

Do you see a possible problem there?

AWOL:

for (int i=0; i< random(TIMES); i++)

Do you see a possible problem there?

I’m new to Arduino, started playing with it today for the first time. However I totally get what you are saying about the 16 bit int. Good to know I can use 32 bit value with unsigned long, I’ll look into that more tomorrow.

I don’t know if that answers my original question though. How do I place a pause between the Lightning and Volcano effect? I don’t want these occurring together which is what is happening with the current sketch. I want lightning effect > wait specified period of time > volcano effect > wait specified amount of time > repeat.

Look up the 'blink without delay' example either in the examples page of this site or in the IDE.
Also read http://forum.arduino.cc/index.php?topic=223286.0