当前位置:网站首页>Programming examples of stm32f1 and stm32subeide - production melody of PWM driven buzzer

Programming examples of stm32f1 and stm32subeide - production melody of PWM driven buzzer

2022-07-01 15:53:00 Visual intelligence

PWM Drive buzzer to produce melody

Buzzer or buzzer is an audio signal device , It can be mechanical 、 Electromechanical or piezoelectric ( Piezoelectric for short ). Its main function is to convert the signal from audio to sound . Generally, it is powered by DC voltage , For timer 、 a burglar alarm 、 The printer 、 a burglar alarm 、 Computer, etc. . According to different designs , It can produce different sounds , Like an alarm clock 、 music 、 Bells and sirens .

 Insert picture description here

Buzzer is divided into active buzzer and passive buzzer . This example uses a passive buzzer , As shown in the figure above .

1、 Buzzer configuration

Development environment construction 、 System clock configuration 、 Debugging configuration and serial port configuration , Please refer to :

This instance passes the PWM Function driven buzzer . By designation PWM Output time length and adjustment PWM output frequency , Generate different sounds ( melody ). The configuration is as follows :

原网站

版权声明
本文为[Visual intelligence]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207011541104716.html