// void setup() {
//   // put your setup code here, to run once:
//  pinMode(2, OUTPUT);
//  Serial.begin(9600);

// }

// void loop() {

// digitalWrite(2, HIGH);
// Serial.println("Realy ON");

// delay(2000);

// digitalWrite(2, LOW);
// Serial.println("Realy Off");
// delay(2000);

// }

#define BLYNK_TEMPLATE_ID "TMPL3TMNK9J5F"
#define BLYNK_TEMPLATE_NAME "LED"
#define BLYNK_AUTH_TOKEN "ZoRvNCwB6j-6aZ4cy9f1AvK3Qsfbp67q"

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";

#define RELAY_MODULE_PIN_1 2 // Connect to the first relay on the relay module
#define RELAY_MODULE_PIN_2 0 // Connect to the second relay on the relay module
#define RELAY_MODULE_PIN_3 4 // Connect to the third relay on the relay module

int SW_State_Relay1 = 0;
int SW_State_Relay2 = 0;
int SW_State_Relay3 = 0;


int SW_State_M = 0;
int SW_State_M2 = 0;
int SW_State_M3 = 0;

BLYNK_WRITE (V0)
{
SW_State_M = param.asInt();
if (SW_State_M == 1)
{
digitalWrite(RELAY_MODULE_PIN_1, HIGH);
Serial.println("RELAY_MODULE_1 ON");
Blynk.virtualWrite(V0, HIGH);
}
else
{
digitalWrite(RELAY_MODULE_PIN_1, LOW);
Serial.println("RELAY_MODULE_1 OFF");
Blynk.virtualWrite(V0, LOW);
}
}
BLYNK_WRITE (V2)
{
SW_State_M2 = param.asInt();
if (SW_State_M2 == 1)
{
digitalWrite(RELAY_MODULE_PIN_2, HIGH);
Serial.println("RELAY_MODULE_2 ON");
Blynk.virtualWrite(V2, HIGH);
}
else
{
digitalWrite(RELAY_MODULE_PIN_2, LOW);
Serial.println("RELAY_MODULE_2 OFF");
Blynk.virtualWrite(V2, LOW);
}
}
BLYNK_WRITE (V4)
{
SW_State_M3 = param.asInt();
if (SW_State_M3 == 1)
{
digitalWrite(RELAY_MODULE_PIN_3, HIGH);
Serial.println("RELAY_MODULE_3 ON");
Blynk.virtualWrite(V4, HIGH);
}
else
{
digitalWrite(RELAY_MODULE_PIN_3, LOW);
Serial.println("RELAY_MODULE_3 OFF");
Blynk.virtualWrite(V4, LOW);
}
}

void setup()
{
  pinMode(RELAY_MODULE_PIN_1, OUTPUT);
  pinMode(RELAY_MODULE_PIN_2, OUTPUT);
  pinMode(RELAY_MODULE_PIN_3, OUTPUT);
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module