#define BLYNK_TEMPLATE_ID "TMPL38HQcYvi8"
#define BLYNK_TEMPLATE_NAME "smart home"
#define BLYNK_AUTH_TOKEN "ZhU-Hmivi9VF2vbOLR4d9_7-4D4qUNbF"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define led 2
#define led1 4
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
//BLYNK_WRITE function is a callback function, that is called by
//the Blynk library when a value is written to a virtual pin.
//This function is called when a value is written to virtual pin V0.
//So, it does not have a return value. Instead, it simply performs
//the actions specified in its body.
BLYNK_WRITE(V0) {
int pinValue = param.asInt();
digitalWrite(led, pinValue);
}
BLYNK_WRITE(V1) {
int pinValue = param.asInt();
digitalWrite(led1, pinValue);
}
void setup()
{
// put your setup code here, to run once:
pinMode(led, OUTPUT);
pinMode(led1,OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
// put your main code here, to run repeatedly:
Blynk.run();
//Blynk.virtualWrite(V1, 400-distance);
}