#define RELAY_PIN 7  // Relay module connected to digital pin 7
#define BUTTON_PIN 2 // Button connected to digital pin 2

void setup() {
  pinMode(RELAY_PIN, OUTPUT); // Set relay pin as output
  pinMode(BUTTON_PIN, INPUT_PULLUP); // Set button pin as input
  digitalWrite(RELAY_PIN, LOW); // Initialize relay in OFF state
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(BUTTON_PIN) == LOW) { // Button pressed
    digitalWrite(RELAY_PIN, HIGH); // Turn relay ON
    Serial.println("Relay is ON");
  } else {
    digitalWrite(RELAY_PIN, LOW); // Turn relay OFF
    Serial.println("Relay is OFF");
  }
}
NOCOMNCVCCGNDINLED1PWRRelay Module