code issues, two buttons and three outputs

Hello everyone

I try to make a code in which two LEDs and a buzzer with one button turn on and all turn off with another button, but when I press the button that turns off everything, the LEDs do not turn off and they start blinking, as if it had not changed state, here is the code

const int llamado = 10;
const int reset = 9;
int sala = 13;
int tablero = 12;
int sonido = 11;
int estado = 0;
int reset_1 = 0;

void setup() {
 
  pinMode(llamado, INPUT);
  pinMode(reset,INPUT);
  pinMode(tablero,OUTPUT);
  pinMode(sala,OUTPUT);
  pinMode(sonido,OUTPUT);
  digitalWrite(llamado,LOW);
  digitalWrite(reset,LOW);

}

void loop() {

   estado = digitalRead(llamado);
   reset_1 = digitalRead(reset);

if (estado == HIGH){
    
    digitalWrite(tablero,1);
    digitalWrite(sala,1);
    digitalWrite(sonido,1);
    
    }


    if(reset_1 == HIGH){  
    digitalWrite(tablero,0);
    digitalWrite(sala,0);
    digitalWrite(sonido,0 );   
    }  
    
    
}

how can i fix it?

Did yo use a (10k) pull down resistor on the button.
Leo..

I did what you told me, you’re a god! It works! Thank you!

An easier way (no external resistors) is to enable internal pull up in pinMode().

pinMode(llamado, INPUT_PULLUP); // button between pin and ground, no resistor
pinMode(reset,INPUT_PULLUP);

If you do so, then a pushed button is pulling the pin LOW.
You must then also change the logic in your code.

if (estado == LOW){
digitalWrite(tablero, HIGH);
....

Leo..