Making an Active Buzzer Beep using Arduino UNO:
To make an active buzzer beep using Arduino, we'll need to set up the circuit and program our board.
Components Required:
- 1 * Arduino UNO
- 1 * USB cable
- 1 * Active buzzer
- 1 * 1 kΩ Resistor
- 1 * NPN Transistor
- 1 * Breadboard
- Several jumpers wire
Circuit Diagram:
1. Make the connections according to the circuit diagram.
2. Connect your Arduino UNO to PC.
3. Upload the code provided to the board using Arduino IDE.
4. Enjoy using Active Buzzer.
Code:
int buzzerPin=8; //definition digital 8 pins
//as pin to control the buzzer
void setup()
{
pinMode(buzzerPin,OUTPUT); //Set digital 8 port mode, the
} //OUTPUT for the output
void loop()
{
digitalWrite(buzzerPin,HIGH); //Set PIN 8 feet as HIGH = 5 v
delay(2000); //Set the delay time,2000ms
digitalWrite(buzzerPin,LOW); //Set PIN 8 feet for LOW = 0 v
delay(2000); //Set the delay time,2000ms
}
Comments
Post a Comment