# 未來板蜂鳴器KittenBlock編程教學

使用蜂鳴器可以為你的項目添加聲音，增加趣味。

![](https://kittenbothk.readthedocs.io/en/latest/_images/kbbanner10.png)

### 蜂鳴器積木塊

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer.png)

#### 範例程式：蜂鳴器頻率發聲

使用頻率控制蜂鳴器。

頻率與音調對照表可以參考： <https://pages.mtu.edu/~suits/notefreqs.html>

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer_code1.png)

#### 範例程式：蜂鳴器持續發聲

持續發聲適合製作琴鍵等的項目。

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer_code2.png)

#### 範例程式：蜂鳴器根據音符發聲

播放中八度的所有音調。

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer_code3.png)

#### 範例程式：播放旋律

* 以c4:2為例子：
  * C代表音調
  * 4代表八度
  * :2代表持續時間

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer_code4.png)

#### 範例程式：播放內置音樂

可以播放預設的旋律，

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer_code5.png)

#### 範例程式：改變播放速率

可以改變播放的速率。

![](https://kittenbothk.readthedocs.io/en/latest/_images/buzzer_code6.png)


---

# 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://sharinghub.kittenbot.hk/mcu/futureboard/kittenblock/buzzer.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.
