#define BLYNK_TEMPLATE_ID "TMPL6QhPdO-v-"
#define BLYNK_TEMPLATE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "1G2cqt9pclgsQe8QfuhFnKna4kDAmEFw"
// Include Blynk library
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#define LED 2
// Replace with your network credentials
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
void setup() {
// Start serial communication for debugging
Serial.begin(9600);
// Set LED pin as output
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW); // Turn LED off by default
// Start Blynk with provided authentication token
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// Debug message to indicate the setup is complete
Serial.println("Blynk and LED setup complete!");
}
void loop() {
Blynk.run();
}
// Blynk function to control LED
BLYNK_WRITE(V1) {
int ledState = param.asInt(); // Get the value from the Blynk app
digitalWrite(ledPin, ledState); // Set the LED state
}