#include <LiquidCrystal_PCF8574.h>

 

LiquidCrystal_PCF8574 lcd(0x27);

 

#define pin_A0 A0

#define pin_PWM 2

 

long PWM;

 

void setup() {

  // put your setup code here, to run once: 

  lcd.begin(20, 4); // initialize the lcd

  delay(200);

  lcd.setBacklight(255);

  lcd.print("PWM:");

}

 

void loop() {

  // put your main code here, to run repeatedly:

  PWM = map(analogRead(pin_A0), 0, 1023, 0, 255);

  analogWrite(pin_PWM, PWM);

 

  lcd.setCursor(5, 0);

  lcd.print(PWM);

  lcd.print("   ");

 

  delay(100);

}