#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL6gZcyTUhD"
#define BLYNK_TEMPLATE_NAME "Kontrol LED"
#define BLYNK_AUTH_TOKEN "gwRyjqf3ij0FJJE2_--17EKC5if_joWa"
#include <WiFi.h>
#include <WiFiClient.h>
#include <Blynk.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define LED1 2
#define LED2 4
#define LED3 5
int switch_state = 0;
BLYNK_WRITE(V0)
{
switch_state = param.asInt();
if (switch_state==1)
{
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
Blynk.virtualWrite(V1, HIGH);
Blynk.virtualWrite(V2, HIGH);
Blynk.virtualWrite(V3, HIGH);
}
else
{
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
Blynk.virtualWrite(V1, LOW);
Blynk.virtualWrite(V2, LOW);
Blynk.virtualWrite(V3, LOW);
}
}
void setup()
{
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}