Controlling backlight of 16*2 LCD without using potentiometer

I am running a simple Hello World program to display it in 16*2 LCD. The backlight of LCD is so much dark that Hello world is not visible. Any option to control the backlight without using potentiometer. Sample code is attached below.

#include <LiquidCrystal.h>
int Contrast=100;
    
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup()
{
  analogWrite(A0,Contrast);
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop()
{

}

Treat the backlight as an LED, which is what it is and control the brightness with a PWM signal. If the backlight draws over 30mA then use a transistor to drive it. You need a seriese resistor in the backlight led to limit the current to a safe value. There may already be resistors on the LCD in seriese with the backlight.

 analogWrite(A0,Contrast);

A0 is an analog input pin. It will not output PWM. See the analogWrite reference.

Contrast and backlight brightness are 2 different things, contrast is usually a 1 time adjustment with the potentiometer on the back, some backlights can be adjusted with PWM, some with code, some are not adjustable, only ON or OFF.

ashishpandey:
I am running a simple Hello World program to display it in 16*2 LCD. The backlight of LCD is so much dark that Hello world is not visible. Any option to control the backlight without using potentiometer.

It is probable that you are referring to the contrast adjustment, nothing to do with the backlight.

You need to show a photo of what is happening.