LCD Problem

Hello guys!
I am a student and am doing my final project of the course of Electronics, Automation and Command.
Basically my project consists of opening a locker with a card reader, an RFID-RC522.
But I have had a problem, when I spent a lot of time testing it, the LCD starts to show strange caracters flying around and I dont know why that happens.

This is my code:

#include <LiquidCrystal.h> //As várias bibliotecas.
#include <SPI.h>
#include <MFRC522.h>

constexpr uint8_t RST_PIN = 5; //Configurável, pinos.
constexpr uint8_t SS_PIN = 53; //Configurável, pinos.

MFRC522 mfrc522(SS_PIN, RST_PIN); // Cria o MFRC522.
LiquidCrystal lcd(22, 23, 24, 25, 26, 27); //Pinos do LCD.
int trinco = 3; //Pino do trinco.
//int buzzer = 6;
int ledverde = 9; //Pino do led-verde.
int ledvermelho = 8; //Pino do led-vermelho.

void setup() {
lcd.begin(16, 2); //LCD liga.
pinMode(trinco, OUTPUT); //Os OUTPUTS dos diferente materiais usados.
// pinMode(buzzer, OUTPUT);
pinMode(ledverde, OUTPUT);
pinMode(ledvermelho, OUTPUT);
Serial.begin(9600); // Inicia a comunicação com o PC.
while (!Serial);
SPI.begin(); // Inicia o SPI bus.
mfrc522.PCD_Init(); // Inicia o MFRC522.
mfrc522.PCD_DumpVersionToSerial();
Serial.println(F("À espera de um cartão"));
}

void loop() {
lcd.clear(); //LCD fica limpo (sem nada escrito).
lcd.setCursor(5, 0); //As "coordenadas" do LCD.
lcd.print("Closed"); //Texto do LCD.
// Procura novos cartões.
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}

// Seleciona um dos cartões.
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}

mfrc522.PICC_DumpToSerial(&(mfrc522.uid)); //Sensor MFRC522.

// Mostra UID na serial
Serial.print("UID da tag :");
String conteudo = "";
byte letra;
for (byte i = 0; i < mfrc522.uid.size; i++) //Sensor MFRC522.
{
Serial.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " ");
_ Serial.print(mfrc522.uid.uidByte*, HEX);_
_ conteudo.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " "));
conteudo.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();
Serial.print("Mensagem : "); //Monitor Série.
conteudo.toUpperCase();
if (conteudo.substring(1) == "E0 7D 96 18") //Se o código do cartão for o correto.
{
// Levanta a cancela, acende o led verde, aciona o trinco e o LCD.
digitalWrite(ledverde, HIGH); //Led-verde liga;
digitalWrite(trinco, HIGH); //Trinco com carga;
Serial.println("Acesso Concebido!"); //Monitor Série.
lcd.clear();
lcd.setCursor(0, 0); //As "coordenadas" do LCD.
lcd.print("Acesso Concebido"); //Texto do LCD.
lcd.setCursor(3, 1); //As "coordenadas" do LCD.
lcd.print("Bem Vindo"); //Texto do LCD.
Serial.println();
delay(5000); //O delay.
digitalWrite(ledverde, LOW); //Led-verde desliga.
digitalWrite(trinco, LOW); //Trinco perde a carga.
}
//Caso não leia o cartão correspondente à abertura.
else*

* {
{
digitalWrite(ledvermelho, HIGH); //Led-vermelho liga.
lcd.clear();
Serial.println("Acesso Interdito!"); //Monitor Série.
lcd.print("Acesso Interdito"); //Texto no LCD.
Serial.println();
delay(5000);
//tone(buzzer, 1000);
//delay(1000);
digitalWrite(ledvermelho, LOW); //Led-vermelho desliga.
}
}
delay(1000); //O delay.
}*_

Interpretation of your code will not be totally reliable since the forum software has interpreted at least some of it as formatting commands. This is evidenced by the change in font midway.

You can fix this by highlighting the code section of your post and then using the 'code' button which looks like this </> .

In general using lcd.clear() in loop() is not a good idea.

Don