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?