Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Internet of things(6B) 21BECE30029

Practical: 3
Aim: Perform buzzer sound on Arduino Uno.
Components:
• Arduino board (e.g., Arduino Uno)
• Buzzer
• Resistor (220-500 ohms)
• Jumper wires

Circuit Connection:
• Connect one leg of the buzzer to a digital pin on the Arduino (e.g., Pin 9).
• Connect the other leg of the buzzer to the ground (GND) on the Arduino.
• Connect one end of the resistor to the same digital pin where the buzzer is connected.
• Connect the other end of the resistor to the 5V output on the Arduino.

Circuit Diagram:
Internet of things(6B) 21BECE30029

Arduino Code:
#define BUZZER_PIN 9
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
tone(BUZZER_PIN, 1000);
delay(1000);
noTone(BUZZER_PIN);

delay(1000);
}

Expected Outcome:
The expected outcome of the provided Arduino code is that the buzzer connected to the
specified digital pin (in this case, Pin 9) will produce a simple tone. The code turns on the
buzzer, generates a tone with a frequency of 1000 Hz, waits for 1 second, turns off the buzzer,
and then waits for another 1 second.

You might also like