Difference between revisions of "Lesson 17--Microduino "Buzzer alarm""
(→Experimental schematic) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{Language|第十七课--Microduino_蜂鸣器警报器}} | ||
{| style="width: 800px;" | {| style="width: 800px;" | ||
|- | |- |
Latest revision as of 14:59, 2 March 2014
Language: | English • 中文 |
---|
ContentsObjectiveWe have used the buzzer in the light alarm experiment. This lesson will give a detailed instruction for the buzzer and use it simulate the air defense warning. Equipment
BuzzerBuzzer is an integration of electron acoustic structure, divided into two types, piezoelectric buzzer and magnetic buzzer. Piezoelectric buzzerPiezoelectric buzzer is mainly composed by the multivibrator, piezoelectric, impedance matching unit and sound box, shell and so on. As shown in figure Magnetic buzzerMagnetic buzzer is composed by the oscillator, the electromagnetic coil, magnets, vibration membrane and shell. Active buzzer and passive buzzer
Difference
Experimental schematicNote:In this experiment must use passive buzzer Programvoid setup()
{
pinMode(3,OUTPUT);
}
void loop()
{
for(int i=200;i<=800;i++) //Dynamic to set the frequence from 200HZ to 800HZ in a cycle
{
tone(3,i); //Output the frequence in port 4
delay(5); //Keep this frequence 5ms
}
delay(4000); //Keep 4mins in the Highest frequence
for(int i=800;i>=200;i--)
{
tone(3,i);
delay(10); //Keep this frequence 10ms
}
} ResultAfter download, you can hear the alarm. Maybe you have found that buzzer with the polarity, actually passive buzzer is nonpolar, and active buzzer is polarity, but for the production cost savings and unified adopted active buzzer encapsulation, so we have the same results for both pin connection. Video |