STM32 using active buzzer to realize alarm clock sound

Source: Internet
Author: User

The sound of the active buzzer is fixed, the operating voltage is constant, changing the time of the power off to obtain a different length of sound, such as continuous, fast short, slow long sound (similar to Morse Telegraph) to distinguish different alarm information.

Simply put, the active buzzer can only emit one sound because its frequency is fixed. can only be differentiated according to the different intervals of the sound.

For example, the alarm clock is: drip ~ drip ~ Drip ~.

As long as the power is ringing, we just have to control the power of the time is good.

#include"mbed.h"pwmout PWM1 (pb_13);intMain () { while(1) {PWM1=1;//rangWait0.1);//Ring 0.1sPWM1 =0;//Not ringingWait0.1);//No sound 0.1sPWM1 =1;//Ring AgainWait0.1);//Ring 0.1sPWM1 =0;//Not ringingWait0.6);//No sound 0.6s    }}//End Main

The above can be achieved, drop 0.1s drops 0.1s (0.6s after) drops 0.1s 0.1s (0.6s) drops 0.1s drops 0.1s

The human ear sounds like the usual alarm clock drip ~ drip ~ drip ~ effect.

Here the PWM wave, replaced by Digitalout is the same, the PWM wave does not have any special significance.

I'm just testing pwm for what effect No.

Change the frequency of the PWM wave, the tone of the buzzer does not change.

Changing the size of the PWM wave, such as the pwm1=0.5, emits an unstable, shaky sound that doesn't work.

So the active buzzer just can ring, sound fixed.

The level =1 is ringing, =0 does not ring.

Cannot upload the recording, the previous picture:

STM32 using active buzzer to realize alarm clock sound

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.