|
Post by 邱老师 on Feb 11, 2021 16:15:50 GMT
int buzzer=9;//信号源接D9口 unsigned char i,j;
void setup() { pinMode(buzzer,OUTPUT); }
void loop() { while(1)
{
for(i=0;i<80;i++)
{
digitalWrite(buzzer,HIGH);
delay(1);
digitalWrite(buzzer,LOW);
delay(1);
}
for(j=0;j<100;j++)
{
digitalWrite(buzzer,HIGH);
delay(2);
digitalWrite(buzzer,LOW);
delay(2);
}
}
}
|
|
|
Post by 邱老师 on Feb 11, 2021 16:46:20 GMT
接线: 如果是模块会有标注:GND VCC IN 如果不是模块,一般正极会标+号,信号接正极,负极接地。
|
|