SKU:U132
BUZZER 是一款无源蜂鸣器
拓展单元,采用4KHz频率信号驱动,额定电压供电情况下,10cm内声压等级可达72dB,具有体积小巧,功耗低,发声效果好,自带保护外壳等特点,适用于各类蜂鸣报警场景。
规格 | 参数 |
---|---|
驱动频率 | 4KHz 1/2duty 方波 |
功耗 | 5V@86mA |
净重 | 3.5g |
毛重 | 8.5g |
产品尺寸 | 24 * 24 * 8mm |
包装尺寸 | 93 * 138mm |
M5CORE - PORT B | G26 |
---|---|
BUZZER | SIGNAL |
#include <Arduino.h>
#define buzzer_pin 26
int freq = 4000;
int ledChannel = 0;
int resolution = 10;
void setup() {
ledcSetup(ledChannel, freq, resolution); //Sets the frequency and number of counts corresponding to the channel. 设置通道对应的频率和计数位数
ledcAttachPin(buzzer_pin, ledChannel); //Binds the specified channel to the specified I/O port for output. 将指定通道绑定到指定 IO 口上以实现输出
ledcWrite(ledChannel, 512); //Output PWM. 输出PWM
}
void loop() {
ledcWrite(ledChannel, 512); //Output PWM. 输出PWM
delay(3000);
ledcWrite(ledChannel, 0); //Output PWM. 输出PWM
delay(3000);
}