# 蜂鸣器模块

## 概述

蜂鸣器模块的蜂鸣器为无源蜂鸣器，根据输入的频率不同，产生不同的声音。蜂鸣器的工作原理是利用电磁感应现象，为音圈接入交变电流后形成的电磁铁与永磁铁相吸或相斥而推动振膜发声，接入直流电只能持续推动振膜而无法产生声音，只能在接通或断开时产生声音。

## 参数

* 尺寸：48x24mm
* 工作电压：5V
* 接口类型：XH2.54mm-3P
* 引脚定义：1-地 2-电源 3-信号

## 接口说明

* 可用端口：2、3、4、9、10、11、12、13、A0、A1、A2、A3

## 使用方式

![](/files/-LWVPWC8K9LZAgVNSyqo)

## 示例代码

![](/files/-LWVPWCAh8Sf0VtnOXQB)

![](/files/-LWVPWCCzxSXGc7dzt8r)

[蜂鸣器模块示例代码](http://www.haohaodada.com/show.php?id=955996)

## 原理图

{% file src="/files/-LrDADEuJQgkAcOLymIn" %}
蜂鸣器模块原理图
{% endfile %}

## 尺寸说明

![](/files/-LWVPVY3e-Jx5ZBpQh7a)

## 常见问题


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.haohaodada.cn/jiao-xue-chan-pin/arduino-kai-yuan-ying-jian/feng-ming-qi-mo-kuai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
