Muhammad_Munir
Published © GPL3+

Push Button ON and OFF Relay with Buzzer indication

Push Button ON and OFF Relay with Buzzer indication

BeginnerFull instructions provided3,685
Push Button ON and OFF Relay with Buzzer indication

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Relay Module
×1
Push Button
×1
10k resistor
×1
Buzzer
×1
Bread Board
×1

Story

Read more

Code

Code

Arduino
#define r1 11   // relay signal pin
#define Buzzer 10  // buzzar pin
int relay1 = LOW;
#define BUTTON_PIN 7  // button pin
void setup() {
  pinMode(r1, OUTPUT);
  pinMode(Buzzer, OUTPUT);
  pinMode(BUTTON_PIN, INPUT);
}
void loop() {
  if (digitalRead(BUTTON_PIN) == HIGH) 
  {
    relay1 = ~ relay1;
    digitalWrite(r1, relay1);
    digitalWrite(Buzzer, HIGH);
    delay(1000);
    digitalWrite(Buzzer, LOW);

  }

}

Credits

Muhammad_Munir
79 projects • 50 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments