#include <stdio.h>
#include <wiringPi.h>
#include <unistd.h>
#define BEEP 0 //设置针脚0为蜂鸣器的控制引脚
int main (void)
{
wiringPiSetup () ;//初始化wiringPi库i
pinMode (BEEP, OUTPUT) ;//设置IO口的输入输出,输出
while(1)
{
//sleep(1);
usleep(100000);
digitalWrite (BEEP, HIGH) ; //设置IO口输出低电平,蜂鸣器响
//sleep(1);
usleep(100000);
digitalWrite (BEEP, LOW) ; //设置IO口输出低电平,蜂鸣器响
}
return 0;
}
标签:H616,蜂鸣器,设置,全志,低电平,BEEP,IO,include
From: https://www.cnblogs.com/xiaohuzaixue/p/16705358.html