/* ESP32 WiFi example */
#define BLYNK_TEMPLATE_ID "TMPLp5_PwgIm"
#define BLYNK_DEVICE_NAME "smart home automation"
#define BLYNK_AUTH_TOKEN "s61su6F4mOjTX3NEA-1YOnXQuqxXheSu"
// 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)
{
int pinValue = param.asInt();
if (pinValue == 1)
{
digitalWrite(23 , HIGH);
}
else
{
digitalWrite(23 , LOW);
}
//Serial.print("New Data - "); Serial.println(blynk_data);
//Serial.print("Pre Data - "); Serial.println(previous_blynk_data);
}
BLYNK_WRITE(V1)
{
int pinValue = param.asInt();
if (pinValue == 1)
{
digitalWrite(22 , HIGH);
}
else
{
digitalWrite(22, LOW);
}
//Serial.print("New Data - "); Serial.println(blynk_data);
//Serial.print("Pre Data - "); Serial.println(previous_blynk_data);
}
BLYNK_WRITE(V2) {
int pinValue = param.asInt();
if (pinValue == 1)
{
digitalWrite(21 , HIGH);
}
else
{
digitalWrite(21, LOW);
}
//Serial.print("New Data - "); Serial.println(blynk_data);
//Serial.print("Pre Data - "); Serial.println(previous_blynk_data);
}
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(23, OUTPUT);
pinMode(22, OUTPUT);
pinMode(21, OUTPUT);
}
void loop()
{
// put your main code here, to run repeatedly:
Blynk.run();
}