Debounce button conversion

every pressed on button just looped led1 from on to off.
led1 on
led1 off
(once I pressed button)
led on
led Off
suppose to be:
led on
led off
Mixer on
Mixer off

const int button = 15;
int buttonstate = 0;
int i = 0;

void setup(){
  pinMode(button,INPUT);
  Serial.begin(9600);
}


void loop(){
  testing();
  delay(1000);
  Serial.println("...........");
}

void testing(){

  for(i=0; i<5; i++){
    Serial.println("led1 On");
    delay(2500);
    Serial.println("led1 off"); 
    
  buttonstate = digitalRead(button);
  if(buttonstate == HIGH){
    Serial.println("Mixer On");
    delay(1000);
    Serial.println("Mixer Off");
  }

  while(!digitalRead(button)){
    }
  }
}

My button.

Your switch seems to be connected to pin 2 but you are reading pin 15.

...R

I was using an arduino picture we have the same button layout but different pin connection.

giogacang: I was using an arduino picture we have the same button layout but different pin connection.

How was I supposed to know that?

Make a pencil diagram of your actual wiring arrangement and post a photo of the drawing.

...R