Buzzers are commonly used to produce beep sounds when some keys are pressed. Beep sound will help us to confirm the key press easily. Many ways are there to connect buzzers in a circuit. A simple circuit to connect a small buzzer to arduino uno is shown below.
After completing the circuit, upload the following program to your arduino board. If uploading is successful, beep sound will be heard from the buzzer in one second delay.
After completing the circuit, upload the following program to your arduino board. If uploading is successful, beep sound will be heard from the buzzer in one second delay.
// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the buzzer on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); // turn the buzzer off by making the voltage LOW delay(1000); // wait for a second }