#define BLYNK_TEMPLATE_ID "TMPL3Googrl3j"
#define BLYNK_TEMPLATE_NAME "LED"
#define BLYNK_AUTH_TOKEN "PAKR_cyDzndMZnQDdohnANrtKWuidK9H"
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#define LED_PIN 2
#define FAN_PIN 4
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST"; // Use Wokwi's guest network
char pass[] = ""; // No password
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(LED_PIN, OUTPUT); // Set LED pin as output
pinMode(FAN_PIN, OUTPUT); // Set Fan pin as output
}
void loop() {
Blynk.run(); // Run Blynk
}
// Function to control LED
BLYNK_WRITE(V0) {
int ledState = param.asInt(); // Get state from Blynk app
digitalWrite(LED_PIN, ledState); // Control LED based on state
}
// Function to control Fan
BLYNK_WRITE(V1) {
int fanState = param.asInt(); // Get state from Blynk app
digitalWrite(FAN_PIN, fanState); // Control Fan based on state
}