Only the first character of the raw shows in LCD

Hello,
I have a problem with the i2c lcd, when uploading the code to the Arduino everything works fine, and the i2c turns on, yet only the first character of the raw shows, while the rest of letters are not showing.
Also I tried it with a basic code and multiple i2c and still i have the same problem (only the first characters are displayed

#include <Wire.h>
#include <LiquidCrystal_I2C.h> 
#include <Servo.h>

Servo servo;
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);


int z = 1;
int led1 = 5;
int led2 = 6;
int led3 = 9;
int filled_led = 2;
int sensor = 6;
// servo = 10
int mode = 7;
int buzzer = 2;
int start = 8;


 
void setup() 
{
  // initialize the LCD
  lcd.begin(16,2);
  // Turn on the blacklight and print a message
 lcd.backlight();
  // A sound notifying the starting of the screen for 0.1 Second
 tone(buzzer, 500);
  delay(100); 
  // Stop Sound
  noTone(buzzer);
  
  lcd.setCursor(0,0); // column, row
  lcd.print("     Welcome    ");
  lcd.setCursor(0,1); // column, row 
  lcd.print(" Filling Machine ");
  delay(3500);
  
  lcd.setCursor(0,0); // column, row
  lcd.print(" Ready ");
  delay(2500);
  // if the sensor detects infrared radiation in its surrounding environment
   if(digitalRead(sensor) == HIGH)
  // A tone is going to start for 0.1 Second
 tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
                                                                                                                                                                       
 lcd.clear();
 pinMode(start, INPUT_PULLUP);
 pinMode (led1,OUTPUT);
 pinMode (led2,OUTPUT);
 pinMode (led3,OUTPUT);
 pinMode (filled_led,OUTPUT);
 pinMode (buzzer,OUTPUT);
 pinMode (sensor, INPUT);
 servo.attach(10);
 servo.write(180);

}
void loop()
{

   int button = digitalRead(mode);
  
  if (button == HIGH)
  {
 tone(buzzer, 500);
  delay(150);
  noTone(buzzer);
  {
    if(z<3)
    z ++;
    else
    z=1;
  }
  }
////////////////////////////////////////////////MODE 1
  
  if 
  (z==1)
  
  {
  digitalWrite (led2,LOW);
  digitalWrite (led3,LOW);
  digitalWrite (led1,HIGH);
   lcd.setCursor(0,0); // column, row
  lcd.print(" PACK 1 #  25Gr"); 
  }
  while(digitalRead(start) == LOW)
{
  if(digitalRead(sensor) == LOW)
  {
      lcd.setCursor(0,1); // column, row
  lcd.print("  Press Start   ");
  }
 if(digitalRead(sensor) == HIGH)
  {
   lcd.setCursor(0,1); // column, row
  lcd.print("   Place Cup    ");
  
  }

  
  if (digitalRead (button) == HIGH)
  break;
}
  ///////////////////////////////////////////////MODE 2
  
  if 
  (z==2)
  {
  digitalWrite (led2,HIGH);
  digitalWrite (led3,LOW);
  digitalWrite (led1,LOW);
   lcd.setCursor(0,0); // column, row
  lcd.print(" PACK 2 #  50Gr"); 
  }
  while(digitalRead(start) == LOW)
{
  if(digitalRead(sensor) == LOW)
  {
       lcd.setCursor(0,1); // column, row
  lcd.print("  Press Start   ");
  }
 if(digitalRead(sensor) == HIGH)
  {
   lcd.setCursor(0,1); // column, row
  lcd.print("   Place Cup    ");
  }

  
  if (digitalRead (button) == HIGH)
  break;
}

//////////////////////////////////////////////////MODE 3
  
   if 
  (z==3
    
  )
  {
  digitalWrite (led2,LOW);
  digitalWrite (led3,HIGH);
  digitalWrite (led1,LOW);
   lcd.setCursor(0,0); // column, row
  lcd.print(" PACK 3 #  75Gr"); 
  }
  while(digitalRead(start) == LOW)
{
  if(digitalRead(sensor) == LOW)
  {
     lcd.setCursor(0,1); // column, row
  lcd.print("  Press Start   ");
  }
 if(digitalRead(sensor) == HIGH)
  {
   lcd.setCursor(0,1); // column, row
  lcd.print("   Place Cup    ");
  
  }

  
  if (digitalRead (button) == HIGH)
  break;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
    delay(200);


     if(digitalRead(start) == HIGH && z==1 && digitalRead(sensor) == LOW ) 
{
 tone(buzzer,500);
  delay(100);
  noTone(buzzer);
   lcd.setCursor(0,1); // column, row
  lcd.print("   Filling... ");
   //<<<=========================================<<< To Calibrate MODE 1, Change this Value
 servo.write(30);
 delay(1000);
  servo.write(180);

 
  
  lcd.setCursor(0,1); // column, row
  lcd.print("Packing Complete");
  
  
  digitalWrite (filled_led,HIGH);
  delay(400);
  tone(buzzer, 500);
  delay(300);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(150);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(300);
  noTone(buzzer);
  delay(1000);
  digitalWrite (filled_led,LOW);
  
  while(digitalRead(sensor) == LOW) 
  {
    if(digitalRead(start) == HIGH)
    {
  lcd.setCursor(0,1); // column, row
  lcd.print(" Place New Cup  ");
   tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
  
    }
if(digitalRead(mode) == HIGH)
    {
  lcd.setCursor(0,1); // column, row
  lcd.print("   Remove Cup   ");
   tone(buzzer, 500);
  delay(200);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(200);
  noTone(buzzer);
  
    }
    
 if(digitalRead(sensor) == HIGH)
 break;
}
 delay(200);
}
if(digitalRead(start) == HIGH && z==1 && digitalRead(sensor) == HIGH ) 

{
   lcd.setCursor(0,1); // column, row
  lcd.print(" Error! No CUP ");
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);

}

 
if(digitalRead(start) == HIGH && z==1 && digitalRead(sensor) == HIGH ) 

{
   lcd.setCursor(0,1); // column, row
  lcd.print("   Place Cup    ");
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);

}



     if(digitalRead(start) == HIGH && z==2 && digitalRead(sensor) == LOW ) 
{
 tone(buzzer,500);
  delay(100);
  noTone(buzzer);
   lcd.setCursor(0,1); // column, row
  lcd.print("   Filling... ");
   //<<<=========================================<<< To Calibrate MODE 1, Change this Value
 servo.write(30);
 delay(2000);
  servo.write(180);


  
  lcd.setCursor(0,1); // column, row
  lcd.print("Packing Complete");
  
  
  digitalWrite (filled_led,HIGH);
  delay(400);
  tone(buzzer, 500);
  delay(300);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(150);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(300);
  noTone(buzzer);
  delay(1000);
  digitalWrite (filled_led,LOW);
  
  while(digitalRead(sensor) == LOW) 
  {
    if(digitalRead(start) == HIGH)
    {
  lcd.setCursor(0,1); // column, row
  lcd.print(" Place New Cup  ");
   tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
  
    }
if(digitalRead(mode) == HIGH)
    {
  lcd.setCursor(0,1); // column, row
  lcd.print("   Remove Cup   ");
   tone(buzzer, 500);
  delay(200);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(200);
  noTone(buzzer);
  
    }
    
 if(digitalRead(sensor) == HIGH)
 break;
}
 delay(200);
}
if(digitalRead(start) == HIGH && z==2 && digitalRead(sensor) == HIGH ) 

{
   lcd.setCursor(0,1); // column, row
  lcd.print(" Error! No CUP ");
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);

}

 
if(digitalRead(start) == HIGH && z==2 && digitalRead(sensor) == HIGH ) 

{
   lcd.setCursor(0,1); // column, row
  lcd.print("   Place Cup    ");
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);

}



     


     if(digitalRead(start) == HIGH && z==3 && digitalRead(sensor) == LOW ) 
{
tone(buzzer,500);
  delay(100);
  noTone(buzzer);
   lcd.setCursor(0,1); // column, row
  lcd.print("   Filling... ");
   //<<<=========================================<<< To Calibrate MODE 1, Change this Value
 servo.write(30);
 delay(3000);
  servo.write(180);


  
  lcd.setCursor(0,1); // column, row
  lcd.print("Packing Complete");
 
  
  digitalWrite (filled_led,HIGH);
  delay(400);
  tone(buzzer, 500);
  delay(300);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(150);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(300);
  noTone(buzzer);
  delay(1000);
  digitalWrite (filled_led,LOW);
  
  while(digitalRead(sensor) == LOW) 
  {
    if(digitalRead(start) == HIGH)
    {
  lcd.setCursor(0,1); // column, row
  lcd.print(" Place New Cup  ");
   tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(100);
  noTone(buzzer);
  
    }
if(digitalRead(mode) == HIGH)
    {
  lcd.setCursor(0,1); // column, row
  lcd.print("   Remove Cup   ");
   tone(buzzer, 500);
  delay(200);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500);
  delay(200);
  noTone(buzzer);
  
    }
    
 if(digitalRead(sensor) == HIGH)
 break;
}
 delay(200);
}
if(digitalRead(start) == HIGH && z==3 && digitalRead(sensor) == HIGH ) 

{
   lcd.setCursor(0,1); // column, row
  lcd.print(" Error! No CUP ");
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);

}

 
if(digitalRead(start) == HIGH && z==3 && digitalRead(sensor) == HIGH ) 

{
   lcd.setCursor(0,1); // column, row
  lcd.print("   Place Cup    ");
   tone(buzzer, 500);
  delay(1000);
  noTone(buzzer);
  delay(30);
   tone(buzzer, 500 );
  delay(1000);
  noTone(buzzer);

}
}

Are you using the latest version of the library(1.1.2), installed through the library manager?

There was bug in the library several years ago when changes were made to the wire library. It has long since been corrected.

forum.arduino.cc/index.php?topic=365435.0

https://forum.arduino.cc/t/5v-iic-i2c-twi-lcd-module-adapter-for-arduino-from-ebay/348465

Since you are just starting out, I would follow the recommendation to use the hd44780.h library from the library manager. It is the best available for the i2c backpack displays.

I agree with @ cattledog, the hs44780 library is superior to any other I2C LCD library.

To install the hd44780 library. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

This topic was automatically closed after 120 days. New replies are no longer allowed.