HELP FOR LCD DISPLAY

I need help with my project and it is urgent. My LCD display went crazy when we upload it to the board. We have checked the connection to ensure that it is correct. We even test the simple “Hello World” code to ensure everything is working perfectly. But when we try to run our code, the LCD went crazy and I have tried so many thing but it is still not working.

My coding

#include<Servo.h>
#include <LiquidCrystal.h>
#include <Keypad.h> 
#include <SoftwareSerial.h>
int angle = 0;
int angle2 = 0;

const int ledPin = 12;
const int buzzerPin = 12;
const int ldrPin = 0;
Servo servoBT; //for bluetooth
Servo servoK; //for keypad
//lcd declaration
LiquidCrystal lcd (1,A1,A2,A3,A4,A5);

int bluetoothTx = 13;

int bluetoothRx = 11;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

//define keypads
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char Keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 3, 2};//connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(Keys), rowPins, colPins, ROWS, COLS);
 
 void setup() 
{ 

 servoBT.attach(9);  //servo push button to pin 9
 
 servoK.attach(10); //servo keypad to pin 10
 
 //lcd display
 pinMode(1,OUTPUT);
 pinMode(A1,OUTPUT);
 pinMode(A2,OUTPUT);
 pinMode(A3,OUTPUT);
 pinMode(A4,OUTPUT);
 pinMode(A5,OUTPUT);
 
 
lcd.begin(16, 2);
lcd.setCursor(0,0);
  lcd.print("INITIALISING.....");
  delay(500);
  
  Serial.begin(9600);


bluetooth.begin(9600);

  pinMode(ledPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ldrPin, INPUT);
  
} 
void loop() 
{ 

//keypad
char Key = customKeypad.getKey();
lcd.clear();
lcd.setCursor(0,1);
lcd.print("key:");
if(Key){        
       //lcd.setCursor(8,1); 
       lcd.setCursor(10,1);             
       lcd.print("Key= ");
       switch(Key){
        case '1':
          lcd.print("1");
          servoK.write(0);
          delay(100);
          servoK.write(90);
          delay(150);
          break;
        case '2':
          lcd.print("2");
          servoK.write(90);
          delay(100);
          servoK.write(120);
          break;
         case '3':
          lcd.print("3");
          servoK.write(150);
          delay(100);
          servoK.write(0);
          break;
         default:
          break;        
       //}
}
if(bluetooth.available()> 0 )

{

int servopos = bluetooth.read();

Serial.println(servopos);

servoBT.write(servopos);

}
int ldrStatus = analogRead(ldrPin);  //read the state of the LDR value

  if (ldrStatus >= 400) {

    tone(buzzerPin, 50);
    digitalWrite(ledPin, HIGH);
    delay(100);

    noTone(buzzerPin);
    digitalWrite(ledPin, LOW);
    delay(100);

    Serial.println("----------- ALARM ACTIVATED -----------"); 
    lcd.print("Light Detected");
  }
  else {

    noTone(buzzerPin);
    digitalWrite(ledPin, LOW);

    Serial.println("ALARM DEACTIVATED");
  }
 
}
}

gila.PNG

Not clear if you mean the Hello World doesn't work any more, and or if your real code used to work but stopped.

Wth does "the LCD went crazy" actually mean.

Where are the servos getting their power from? If from the Arduino 5V, then the whole "the LCD went crazy" might be power related. Servos need their own power.

Hi, thank you for replying. What I meant was, when I tried to test a simple coding like the "Hello World", the LCD showed the exact thing. When I run the code I gave above, the display does not stop and you can refer to my attachment what went wrong with the lcd. It keeps on printing out gibberish word and some Japanese character. I power up the arduino with laptop.

What is connected to pin 1?

AWOL: What is connected to pin 1?

A0 is supposed to be connected in the LCD too, but it has been replaced with LDR pin, therefore the LCD is connected to pin1

I'll try a different approach.

What else is using pin 1?

AWOL: I'll try a different approach.

What else is using pin 1?

only the LCD.

Qaqa: only the LCD.

Try again.

Here's a hint  Serial.begin(9600);

AWOL: Here's a hint  Serial.begin(9600);

what do you mean? do i have to delete it?

https://www.arduino.cc/en/Reference/Serial :

Serial is used for communication between the Arduino board and a computer or other devices.
All Arduino boards have at least one serial port (also known as a UART or USART): Serial.
It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB.
Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.

Moderator edit: Swapped code tags for quote tags.