Using Buzzer For Output
Introduction
Arduino is often used with input and output peripherals.
Common output components used with Arduino in mini-projects are LED and Buzzer.
Similarly, a potentiometer is a commonly used input device for analog input to
Arduino. In this article, we will dive into understanding these components and
making exciting mini projects using these.
Using Buzzer For Output
Circuit Diagram:

Software
Setup:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pin connected to buzzer | |
int buzzer = 5; | |
void setup() | |
{ | |
// Defines the Buzzer pin as output | |
pinMode(buzzer,OUTPUT); | |
} | |
void loop() | |
{ | |
for(int i = 0; i<= 1023; i++) | |
tone(buzzer,i*4,1000); //Output buzzer for read frquency input fo 1 second | |
} |
Output Demo:
Comments
Post a Comment