# 双模蓝牙模块

### 简介

蓝牙模块为标准透传模块，将串口数据发送至连接蓝牙的设备上。

您可以通过蓝牙连接方式对机器人进行无线上传程序或控制其运动。 您甚至可以使用我们的智能手机 APP [Petoi](https://docs.petoi.com/v/chinese/shou-ji-ying-yong/xiao-zhun-yu-kong-zhi) 控制机器人。 我们在标准机器人套件中已包含了我们的官方蓝牙模块。如下图所示：

![](/files/ck3tvYzOEkyBFlo3dsmG)

### 与NyBoard连接

蓝牙模块与 NyBoard 的连接如下图所示，您需要将蓝牙模块插入 NyBoard 上的 6 针插座。 注意蓝牙模块的引脚顺序。 将电池连接到 NyBoard 后，长按电池上的按钮为机器人供电。 蓝牙模块上连接指示灯闪烁表示正在等待连接。

![](/files/Rrds4fz6Z55Cfcy2G2Uj)

### 与手机连接

您需要在 Petoi App 内连接蓝牙，而不是在手机的系统蓝牙设置中。在某些型号的手机上，您可能需要给 app 蓝牙和位置服务的权限。更详细的配置说明请参阅[手机 app ](https://docs.petoi.com/v/chinese/shou-ji-ying-yong/xiao-zhun-yu-kong-zhi)章节。

### &#x20;与电脑连接

在系统的蓝牙设置中，搜索以 Petoi 或 Bittle 开头的蓝牙设备名称，然后连接。 配对的默认 PIN 码是“0000”或“1234”（为了方便连接，后续批次默认密码设置为“0000“）。 配对成功后，系统会分配一个串口名称。

{% hint style="info" %}
在 Mac 上，转到系统偏好设置 -> 蓝牙，找到以 Petoi 或 Bittle 开头的设备名称，然后连接。
{% endhint %}

![](/files/WHv2V5vBh3Gs0539n6Vg)

{% hint style="info" %}
在 Windows 上，在系统设置中添加蓝牙设备，具体步骤如下列图示：
{% endhint %}

![](/files/O1uqky8cxaJyhH6kKvml) ![](/files/OntktMueasNOlEK4rghL)

![](/files/5wGer0KtpfVvB73gHdDX) ![](/files/AJaoemyjMytK9ONi0goW)

![](/files/784ObE3lBbCxY09g71ZA) ![](/files/MkveffwR9kT7v873af1R)

![](/files/tRZ1bnqlRsmlFaDhEff4)

{% hint style="info" %}
对于Windows 10用户，系统会将蓝牙分配“传入”COM口和“传出”COM口，请使用“传出”COM口。具体步骤如下图所示：
{% endhint %}

![](/files/2smDuW9SQtPWt8g3Ccov)

![](/files/8Gz2A0l9s3POOeyZJz52)

然后您可以在 Arduino IDE 的 Tools->Port 下选择它，使用方法与USB上载器相同。打开串口监视器后请选择：没有结束符（No line ending），波特率设置为 **115200。**

{% hint style="info" %}
电脑端的蓝牙连接时常会自动断开，打开 Arduino 的串口监视器可以保持连接。但要注意，这也会独占蓝牙串口，使其他应该无法访问它。
{% endhint %}

### 配置蓝牙模块

如果需要配置蓝牙模块，请参考“JDY-23 AT指令集”。将蓝牙模块插在USB上载器的通信模块调试接口上。如下图所示：

![](/files/YeeyExLbJerNfMuuStCO)

以下列出常用的指令：

| 用途         | 指令                                              | 示例                                                                        |
| ---------- | ----------------------------------------------- | ------------------------------------------------------------------------- |
| 查询蓝牙软件版本   | AT+VER                                          | <p>AT+VER</p><p>>+VER=JDY-23A-V2.21,Bluetooth V3.0+BLE（版本信息）</p>          |
| 查询蓝牙广播名    | AT+NAME                                         | <p>AT+NAME</p><p>>+NAME=BITTLE</p>                                        |
| 更改蓝牙广播名    | AT+NAME(名字)                                     | <p>AT+NAMEPuppy</p><p>>+OK</p><p>AT+NAME</p><p>>+NAME=Puppy</p>           |
| 更改蓝牙BLE广播名 | AT+NAM<mark style="color:red;">**B**</mark>(名字) | <p>AT+NAMBPuppy</p><p>>+OK</p><p>AT+NAMB</p><p>>+NAMB=Puppy</p>           |
| 查询串口速率     | AT+BAUD                                         | <p>AT+BAUD</p><p>>+BAUD=8 （8 = 115200， 7=57600）</p>                       |
| 更改串口速率     | AT+BAUD                                         | <p>AT+BAUD7</p><p>>+OK （需要调整串口监视器至57600）</p><p>AT+BAUD</p><p>>+BAUD=7</p> |

&#x20;打开Arduino IDE中的串口监视器，配置蓝牙模块时请选择：NL and CR（发送新行/回车）， 波特率请设置为 **115200，**&#x5426;则JDY-23模块将不识别任何指令。

![](/files/-MX5he3vsd-zAJM-lcTT)

###

{% hint style="info" %}
如果想使用BLE功能，请扫描后连接BittleBLE-xxxx（随机数字），可以使用Lightblue软件对BLE进行常规调试。
{% endhint %}


---

# 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.petoi.com/chinese/tong-xin-mo-kuai/shuang-mo-lan-ya-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.
