
#define BLYNK_PRINT Serial

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

char auth[] = "65Jw_ziViy-ADWRScVDYRhMuDR6ZfUKO"; //change with your token 

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Ciccio";  //change with your wifi
char pass[] = "1234asdf"; //change with your pass
String  setValue1,setValue2,setValue3,setValue4;  

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600                     //<---------------------------------------------------------

ESP8266 wifi(&Serial);                        //<---------------------------------------------------------

LiquidCrystal_I2C lcd(0x27,20,4);  // Set the LCD I2C address

void setup()
{
  // Debug console
  //Serial.begin(9600);                       //<---------------------------------------------------------

  // Set ESP8266 baud rate
  Serial.begin(ESP8266_BAUD);                 //<---------------------------------------------------------
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
  lcd.init(); 
  lcd.backlight();
}
BLYNK_WRITE(V1) {
  setValue1 = param.asStr();          //reads the variable v1
  lcd.setCursor(0,0);
  lcd.print("                    ");  //clear the first row
 // lcd.backlight();
  Serial.print(setValue1);
  lcd.setCursor(0,0);   //set the cursor in 0,0 (column,row)
  lcd.print(setValue1);
}
BLYNK_WRITE(V2) {
  setValue2 = param.asStr();           //reads the variable v2
 // lcd.backlight();
  lcd.setCursor(0,1);
  lcd.print("                    "); //clear the second row
  Serial.print(setValue2);
  lcd.setCursor(0,1);               //set the cursor in 0,1 (column,row)
  lcd.print(setValue2);             
}
BLYNK_WRITE(V3) {
  setValue3 = param.asStr();         //reads the variable v3
 // lcd.backlight();
  lcd.setCursor(0,2);
  lcd.print("                    ");//clear the third row
  Serial.print(setValue3);
  lcd.setCursor(0,2);              //set the cursor in 0,2 (column,row)
  lcd.print(setValue3);
}
BLYNK_WRITE(V4) {
  setValue4 = param.asStr();         //reads the variable v4
 // lcd.backlight();
  lcd.setCursor(0,3);
  lcd.print("                    "); //clear the fourth row
  Serial.print(setValue4);
  lcd.setCursor(0,3);             //  set the cursor in 0,3 (column,row)
  lcd.print(setValue4);
}
void loop()
{
  Blynk.run();
}
