51单片机蜂鸣器操作

让蜂鸣器响很简单,给蜂鸣器加一个低电平,这样电流通过,蜂鸣器就会响。
代码很简单,应该很容易懂的!

#include <reg52.h>

sbit beep=P2^3;
void main()
{
    int a;
    while(1)
    {
        a=66666;
        beep=0;
        while(a--);
        a=66666;
        beep=1;
        while(a--);
    }
}
0

9 thoughts on “51单片机蜂鸣器操作

  1. Undeniably imagine that that you stated. Your favorite reason appeared to be at the
    internet the easiest factor to have in mind of. I say to you, I definitely get annoyed even as other people think about concerns that they just do not realize about.
    You controlled to hit the nail upon the highest and also defined
    out the whole thing without having side effect ,
    people could take a signal. Will probably be back
    to get more. Thanks

    0
  2. Good day! I know this is kinda off topic but I was wondering if you knew where I
    could get a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having problems finding
    one? Thanks a lot!

    0

Leave a Reply

Your email address will not be published.