#define BLYNK_TEMPLATE_ID "TMPL3RNDGyASh"
#define BLYNK_TEMPLATE_NAME "LEDcontrol"
#define BLYNK_AUTH_TOKEN "54b_Tm-h7YU8BhEE_mxB1b8HmmBWdG7g"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V0)
{
if(param.asInt()==1){
digitalWrite(2, HIGH);
Blynk.virtualWrite(V1,1);
}
else{
digitalWrite(2, LOW);
Blynk.virtualWrite(V1,0);
}
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(2,OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}