// Blynk app settings (Replace with yours)
#define BLYNK_TEMPLATE_ID "TMPL6i2iCKGgK"
#define BLYNK_TEMPLATE_NAME "PLC Node"
#define BLYNK_AUTH_TOKEN "k0IP0MMrjIQppxdNsQOfvaGEvBIz922q"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Wire.h> // Include for I2C communication
#include <LiquidCrystal_I2C.h> // Include for I2C LCD
int i=0;
int a=0;
// Define LCD and sensor pins
LiquidCrystal_I2C lcd(0x27, 20, 4); // I2C address, columns,
char auth[] = BLYNK_AUTH_TOKEN;
// WiFi credentials (Replace with yours)
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BLYNK_WRITE(V0)
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
if (pinValue == 1)
// process received value
lcd.backlight();
lcd.setCursor(a,0);
lcd.print(" B ");
a=a+1;
}
BLYNK_WRITE(V1)
{
int pinValue = param.asInt();
if (pinValue == 1)
// process received value
lcd.backlight();
lcd.setCursor(i,0);
lcd.print(" A ");
i=i+1;
}
BLYNK_WRITE(V2)
{
int pinValue = param.asInt();
if (pinValue == 1)
// process received value
lcd.init();
lcd.backlight();
lcd.setCursor(0, 3);
lcd.print("");
}
void setup() {
Serial.begin(115200);
// Initialize I2C communication and LCD
Wire.begin();
lcd.init();
lcd.backlight();
// Set LCD display message
lcd.print("Initializing...");
// Connect to Blynk app
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop() {
Blynk.run();
}