Matrix keyboard and other stuff's

Hello everyone, so I'm doing a project which involves a Buzzer, the HCSR04 (ultrasonic sensor), an LCD display and a matrix keyboard.
My idea is to make the led light up when the distance read by the HCSR04 is smaller than the one
pressed on the keyboard, however the buzzer would only buzz with the predefined distance.
Sorry if I didn't know how to express myself, I'm not a fluent English speaker.
(obs: i'm ussing 2 HCSR04)

//teclado = keyboard

#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define LED 13 

int lcdColumns = 16;
int lcdRows = 2;
int buzzer_pin = 23;
int buzzer_channel = 0;

int trigPin1 = 5;
int EchoPIN1 = 19;
int trigPin2 = 12;
int EchoPIN2 = 18;   

#define SOUND_SPEED 0.034
#define CM_TO_INCH 0.393701
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);  

const byte linhas = 4; 
const byte colunas = 4; 
char teclado[linhas][colunas] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte pinos_linhas[linhas] = {14, 27, 26, 25}; 
byte pinos_colunas[colunas] = {33, 32, 35, 34}; 

Keypad tecla_pressionada = Keypad( makeKeymap(teclado), pinos_linhas, pinos_colunas, linhas, colunas); 

void setup(){
  pinMode(LED, OUTPUT);
  ledcAttachPin(buzzer_pin, buzzer_channel);
  lcd.begin();
                     
   lcd.backlight();
  pinMode(trigPin1,OUTPUT);
  pinMode(EchoPIN2,INPUT);
  pinMode(trigPin2,OUTPUT);
  pinMode(EchoPIN2,INPUT);
  Serial.begin(9600);
  lcd.print("ligando...");
}

void loop(){


   digitalWrite(trigPin1,LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin1,HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin1,LOW);


  char teclado = tecla_pressionada.getKey();

  if (teclado){
    Serial.println(teclado);
  }


 
  
  long timedelay = pulseIn(EchoPIN1,HIGH);
  int distance1 = 0.0343 * (timedelay/2);

   Serial.print("Sensor 1 : ");
  Serial.println(distance1);

 delayMicroseconds(2);

 digitalWrite(trigPin2,LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin2,HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin2,LOW);

  long td = pulseIn(EchoPIN2,HIGH);
  int distance2 = 0.0343 * (td/2);

  Serial.print("Sensor 2 : ");
  Serial.println(distance2);
  


if (distance1 <=5){
   ledcWriteNote(buzzer_channel, (note_t)NOTE_D, 8);
      delay(10);
  
}
 
else if (distance2 <=5){
      ledcWriteNote(buzzer_channel, (note_t)NOTE_D, 8);
      delay(10);
  
  }

  else if (teclado){
    digitalWrite(LED,HIGH);
    }

    else if (teclado){
      digitalWrite(LED,HIGH);
    }

    
else
  {
      ledcWrite(0, 0);
      delay(10);

     digitalWrite(LED, LOW);
  }
    
  lcd.setCursor(0, 0);
  lcd.print(distance1);
  lcd.print(" cm direita  ");

 lcd.setCursor(0,1);
  lcd.print(distance2);
  lcd.print(" cm esquerda");
  delay(1000);
}

Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

Your code does not seem to be complete but maybe e.g. ledcAttachPin and ledcWriteNote are something specific for the ESP32?

char teclado = tecla_pressionada.getKey() places a character in teclado. To compare that with an integer (distance), you can subtract '0' (if the pressed key is numeric).

You have not made clear if the distance that you want to enter on your keypad is limited to a single digit ('0'..'9') or that is can be e.g. "33" or "17" or "123456" or ... .

As well as the other stuff pointed out to you:-

You trigger the ultrasonic sensor, and then you mess about printing things sometimes and then you start timing the return pulse, this gives you a variable inaccuracy. You should do this:-

  digitalWrite(trigPin1,LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin1,HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin1,LOW);
  long timedelay = pulseIn(EchoPIN1,HIGH);
  int distance1 = 0.0343 * (timedelay/2);

  char teclado = tecla_pressionada.getKey();

  if (teclado){
    Serial.println(teclado);
  }

You do the second distance sensor correctly. However, the effects of the first sensor will still be happening when you fire off the second, so that might affect the second reading and you could be getting a false reading for that.

Yes, is for ESP32

Hello, can be more tha one digit, can you send me the schedule?
Thak You!