#define BLYNK_TEMPLATE_ID "TMPL3O2NSHL4C"
#define BLYNK_TEMPLATE_NAME "My templates"
#define BLYNK_AUTH_TOKEN "3Sbi3q_j0k-i5cFZGLuGMJsMmQjdDlLb"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char ssid[]="Wokwi-GUEST";
char pass[]="";
BlynkTimer timer;
BLYNK_WRITE(V0)
{
Serial.println("inside blynk write");
while(1)
{
if(param.asInt()==1)
{
Serial.println("blynk write: pin value is 1");
digitalWrite(2, HIGH);
}
else
{
Serial.println("blyunk write:pin value is 0");
digitalWrite(2,LOW);
}
}
}
BLYNK_CONNECTED()
{
Blynk.syncVirtual(V0);
Serial.println("inside blynk connected");
}
void myTimerEvent()
{
Blynk.virtualWrite(V0,millis()/1000);
}
void setup() {
pinMode(2, OUTPUT);
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Serial print starts...");
Blynk.begin(BLYNK_AUTH_TOKEN,ssid,pass);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run(); // this speeds up the simulation
}