#define BLYNK_TEMPLATE_ID "TMPL6zTLwNRKz"
#define BLYNK_TEMPLATE_NAME "On Off Robot"
#define BLYNK_AUTH_TOKEN "k2HZMY8oKgon-LnOFLqdIORx8QiCCqSI"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
BlynkTimer timer;
char auth[] = "k2HZMY8oKgon-LnOFLqdIORx8QiCCqSI";
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define BLYNK_PRINT Serial
// Define the pin where the LED is connected
const int ledPin = 2;
void setup() {
// Initialize the LED pin as an output
pinMode(ledPin, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
BLYNK_WRITE(V0) {
int pinValue = param.asInt(); // Get the value of the virtual pin
if (pinValue == 1) {
digitalWrite(ledPin, HIGH); // Turn the LED on
} else {
digitalWrite(ledPin, LOW); // Turn the LED off
}
}
void loop() {
Blynk.virtualWrite (V0 , ledPin);
Blynk.run();
timer.run();
}