#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL3NC2zi6yC"
#define BLYNK_TEMPLATE_NAME "Smart Home"
#define BLYNK_AUTH_TOKEN "9VitDheJboohXXntl59gN5z8jJNspxGi"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
int FanValue = 0;
int ACValue = 0;
int LightValue = 0;
BLYNK_WRITE (V0)
{
FanValue = param.asInt();
if(FanValue == 1){
digitalWrite(23, HIGH);
}else {
digitalWrite(23, LOW);
}
}
BLYNK_WRITE (V1)
{
ACValue = param.asInt();
if(ACValue == 1){
digitalWrite(22, HIGH);
}else {
digitalWrite(22, LOW);
}
}
BLYNK_WRITE (V2)
{
LightValue = param.asInt();
if(LightValue == 1){
digitalWrite(21, HIGH);
}else {
digitalWrite(21, LOW);
}
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(22, OUTPUT);
pinMode(23, OUTPUT);
pinMode(21, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
}