Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
semsemharaz
Published

Interfacing Buzzer with Arduino

In this project, we are going to learn how to interface buzzer with Arduino.

BeginnerProtip3,025
Interfacing Buzzer with Arduino

Things used in this project

Story

Read more

Schematics

Schematic for the project

Code

Code

C/C++
//* Interfacing buzzer with Arduino 
//* Author: Osama Ahmed 

int buzzer=10;                //Defining variable and the GPIO pin on Arduino
void setup() 
{
  pinMode(buzzer, OUTPUT);    //Defining the pin as OUTPUT
  //put your setup code here:
}

void loop() 
{

  digitalWrite(buzzer, HIGH);   //Setting the pin HIGH
  delay(2000);
  digitalWrite(buzzer, LOW);    //Setting the pin HIGH
  delay(2000);
  //put your main code here, to run repeatedly:
}

Credits

semsemharaz

semsemharaz

6 projects • 1 follower

Comments