delay() is multiplied

Hi. I have this working code for traffic light and sound trigger with I2C. However, I have noticed that it doesn't follow the delay I have placed. For example, I have a delay(15000), the LED's would light for up to 60 secs. I am wondering what could be done for this.

Here is the code I am working:

#include <Wire.h>

int North[] = {2, 3, 4};
int West[] = {5, 6, 7};
int South[] = {8, 9, 10};
int East[] = {11, 12, 13};
int redDelay = 15000;
int yellowDelay = 3000;

void setup()
{
  Wire.begin(8);                // join i2c bus with address #8
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
    for (int i = 0; i < 3; i++) {
    pinMode(North[i], OUTPUT);
    pinMode(West[i], OUTPUT);
    pinMode(South[i], OUTPUT);
    pinMode(East[i], OUTPUT);
    }


}

int threshold = 200;

void loop()
{
       // Making Green  LED at signal 1 and red LED's at other signal HIGH
  digitalWrite(North[2], HIGH);
  digitalWrite(North[0], LOW);
  digitalWrite(West[0], HIGH);
  digitalWrite(South[0], HIGH);
  digitalWrite(East[0], HIGH);
  delay(redDelay);
  // Making Green LED at signal 1 LOW and making yellow LED at signal 1 HIGH for 2 seconds
  digitalWrite(North[1], HIGH);
  digitalWrite(North[2], LOW);
  delay(yellowDelay);
  digitalWrite(North[1], LOW);

  // Making Green  LED at signal 2 and red LED's at other signal HIGH
  digitalWrite(North[0], HIGH);
  digitalWrite(West[2], HIGH);
  digitalWrite(West[0], LOW);
  digitalWrite(South[0], HIGH);
  digitalWrite(East[0], HIGH);
  delay(redDelay);
  // Making Green LED at signal 2 LOW and making yellow LED at signal 2 HIGH for 2 seconds
  digitalWrite(West[1], HIGH);
  digitalWrite(West[2], LOW);
  delay(yellowDelay);
  digitalWrite(West[1], LOW);

  // Making Green  LED at signal 3 and red LED's at other signal HIGH
  digitalWrite(North[0], HIGH);
  digitalWrite(West[0], HIGH);
  digitalWrite(South[2], HIGH);
  digitalWrite(South[0], LOW);
  digitalWrite(East[0], HIGH);
  delay(redDelay);
  // Making Green LED at signal 3 LOW and making yellow LED at signal 3 HIGH for 2 seconds
  digitalWrite(South[1], HIGH);
  digitalWrite(South[2], LOW);
  delay(yellowDelay);
  digitalWrite(South[1], LOW);

  //Serial.println(LastGreen);
  // Making Green  LED at signal 4 and red LED's at other signal HIGH
  digitalWrite(North[0], HIGH);
  digitalWrite(West[0], HIGH);
  digitalWrite(South[0], HIGH);
  digitalWrite(East[2], HIGH);
  digitalWrite(East[0], LOW);
  delay(redDelay);
  // Making Green LED at signal 4 LOW and making yellow LED at signal 4 HIGH for 2 seconds
  digitalWrite(East[1], HIGH);
  digitalWrite(East[2], LOW);
  delay(yellowDelay);
  digitalWrite(East[1], LOW);
}

boolean stp = false; 
//boolean off = false;
//boolean yellowon = false;

int x;

void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
      char c = Wire.read();  

      }
  if ( stp == false ){
   x = Wire.read();   
    Serial.println(x);
  }


   if (x >= threshold) {
   while ( stp = true) {
    digitalWrite(North[0], LOW);
    //digitalWrite(North[1], LOW);
    digitalWrite(North[2], LOW);
    digitalWrite(West[0], LOW);
    //digitalWrite(West[1], LOW);
    digitalWrite(West[2], LOW);
    digitalWrite(South[0], LOW);
    //digitalWrite(South[1], LOW);
    digitalWrite(South[2], LOW);
    digitalWrite(East[0], LOW);
    //digitalWrite(East[1], LOW);
    digitalWrite(East[2], LOW);
    delay(90000);
    digitalWrite(North[1], HIGH);
    digitalWrite(West[1], HIGH);
    digitalWrite(South[1], HIGH);
    digitalWrite(East[1], HIGH);
    delay(90000);

    digitalWrite(North[0], HIGH);
    digitalWrite(North[1], LOW);
    digitalWrite(West[0], HIGH);
    digitalWrite(West[1], LOW);
    digitalWrite(South[0], HIGH);
    digitalWrite(South[1], LOW);
    digitalWrite(East[0], HIGH);
    digitalWrite(East[1], LOW);
    delay(180000);
           
break;
   }
  stp = false;
//off = true;
   }
 /* if (off == true){
     delay(90000);
    digitalWrite(North[1], HIGH);
    digitalWrite(West[1], HIGH);
    digitalWrite(South[1], HIGH);
    digitalWrite(East[1], HIGH);
   
yellowon = true;
off = false;
} 
if (yellowon == true){
   delay(90000);
    digitalWrite(North[0], HIGH);
    digitalWrite(North[1], LOW);
    digitalWrite(West[0], HIGH);
    digitalWrite(West[1], LOW);
    digitalWrite(South[0], HIGH);
    digitalWrite(South[1], LOW);
    digitalWrite(East[0], HIGH);
    digitalWrite(East[1], LOW);
    delay(60000);
    yellowon = false;
    }
*/
   }

Hi. I have this working code for traffic light and sound trigger with I2C.

    while ( stp = true)

I see that you did not fix your code as suggested in your pother thread in which it featured

I actually did. But instead of running the sequence I intend it to do, it became sound sensitive. That's why I had to create a workaround.

It's working now, it's just that the delay defined is not being followed.

It's working now

If you say so, but the while loop testing stp (or trying to) is completely unnecessary

Which Arduino board are you running this on ?

Does the example Blink program behave as expected ?

Do you have the I2C hooked up? If so are you transmitting anything to your board? Your receiveEvent function has all kinds of delays and could happen at any time during the loop() function.