Why my LCD does not work with this if statement? #include &lt;LiquidCrystal.h&gt;
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); 
int greenLedPin = 12;
int blueLedPin = 11;
int redLedPin = 8;
int yellowLEdPin = 9;

int lightSensorPin = A0;
int analogValue = 0;

void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2); 
  pinMode(greenLedPin, OUTPUT);
  pinMode(blueLedPin, OUTPUT);
  pinMode(redLedPin, OUTPUT);
  pinMode(yellowLEdPin, OUTPUT);
  Serial.begin(9600);
  while (! Serial);

}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(analogRead(lightSensorPin));
  analogValue = analogRead(lightSensorPin);
  if (analogValue &lt; 50) {

digitalWrite(redLedPin, HIGH);


  }
  else if (analogValue &gt;= 50 &amp;&amp; analogValue &lt;= 99) {
    digitalWrite(yellowLEdPin, HIGH);
  }
  else if (analogValue &gt;= 100 &amp;&amp; analogValue &lt;= 300) {

    digitalWrite(blueLedPin, HIGH);
    lcd.print("its bright");
 }
  else {
      digitalWrite(greenLedPin, HIGH);
      lcd.print("its bright");
      }

  delay(3000);
  digitalWrite(greenLedPin, LOW);
  digitalWrite(blueLedPin, LOW);
  digitalWrite(redLedPin, LOW);
  digitalWrite(yellowLEdPin, LOW);
  lcd.clear();

}


I'm very new to this so sorry if its a dumb mistake and I know my LCD is working right, since I have tested it so all the pins are good.
On the Uno, pin 0 and 1 are used for Serial. You can't use pin 1 for Serial in addition to the LCD. In general, it's best to avoid using pins 0 and 1.

You need to change the LCD wiring to use a different pin and update the code accordingly. For example, if you moved the LCD's RS pin connection from pin 1 on your Arduino to pin 13, you would update this line from:



LiquidCrystal lcd(1, 2, 4, 5, 6, 7);


to:

LiquidCrystal lcd(13, 2, 4, 5, 6, 7);


After that, your LCD should work correctly.