#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL3I5h0zLCP"
#define BLYNK_TEMPLATE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "N8PDN3Uek8IJep22RT9tsNE-7-wm50A_"
// Replace with your network credentials
//char auth[] = "dg4O5XaZ9qPsz-nbwvK3RAL6lOIo8GwU"; // Blynk Auth Token
char ssid[] = "Wokwi-GUEST"; // Your Wi-Fi SSID
char pass[] = ""; // Your Wi-Fi Password
// Define the pin where the LED is connected
#define LED_PIN 5
// Setup Blynk virtual pin
BLYNK_WRITE(V0) {
int pinValue = param.asInt();
digitalWrite(LED_PIN, pinValue);
}
void setup() {
// Start serial communication
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
// Initialize the LED pin
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW); // Initially turn off the LED
// Connect to Blynk
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop() {
Blynk.run(); // Keep Blynk running
}