#define BLYNK_TEMPLATE_ID "TMPL3s8jjU_MT"
#define BLYNK_TEMPLATE_NAME "LDR"
#define BLYNK_AUTH_TOKEN "84qWAeho5M41MOhMdbQfxyBkc9AEfWkE"
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
int LDR=2;//D2
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(LDR,INPUT);
}
void loop()
{
int value=digitalRead(LDR);
Serial.println(value);
Blynk.virtualWrite(V0,value);
if(value==0)
{
Blynk.virtualWrite(V1,"LIGHT IS OFF");
}
else
{
Blynk.virtualWrite(V1,"LIGHT IS ONN");
}
}