#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL3p4f7BFcG"
#define BLYNK_TEMPLATE_NAME "lcd display"
#define BLYNK_AUTH_TOKEN "GUjzfCEBAHwhUhRvSE9U8a-0L3wa99fG"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <LiquidCrystal_I2C.h>
char ssid[]="Wokwi-GUEST";
char pass[]="";
char auth[] = "GUjzfCEBAHwhUhRvSE9U8a-0L3wa99fG"; // Your Blynk authentication token
LiquidCrystal_I2C lcd(21, 22, 23, 19, 18, 17); // Pins for LCD (Adjust pins according to your setup)
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
}
void loop() {
Blynk.run();
}
// Define Blynk virtual pin handler
BLYNK_WRITE(V0) {
// This function gets called when there's a write to virtual pin V0
String value = param.asStr(); // Get the value from the app
lcd.clear(); // Clear the LCD
lcd.setCursor(0, 0); // Set cursor to first row, first column
lcd.print(value); // Print the value on LCD
Blynk.virtualWrite(V0, "Sensor Data: " + value); // Send the value to Label widget in Blynk
}