蓝牙HC-05仅针对INQ命令发送错误1F [英] Bluetooth HC-05 sending error 1F for INQ command only

查看:542
本文介绍了蓝牙HC-05仅针对INQ命令发送错误1F的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的新蓝牙HC-05模块有问题.在AT模式下,它可以完美地与我需要的所有命令配合使用……例如INQ. 我已经尝试过预先发送其他所有命令:

I have a problem with my new bluetooth HC-05 module. In AT-mode it works perfectly with all commands that I need... exept INQ. I have tried to send whole bunch of other commands beforehand:

AT+INIT
OK
AT+ORGL
OK
AT+ROLE=1
OK
AT+CLASS=0
OK

它们都工作正常.我也尝试更改IAC和INQM设置...但是模块的答案始终是相同的:

They all are working just fine. I tried to change IAC and INQM settings as well... but the answer from module is always the same:

AT+INQ
ERROR:(1F)

我在此处阅读了相关主题,并尝试按HC-05的建议在HC-05处按下按钮,但是- -也没有结果. 我来自同一家商店的三个模块,它们都以相同的方式工作

I read related topic here and tried to push the button at HC-05, as it recommended there, but -- no result either. I have three modules from the same shop, and they all are working the same way

推荐答案

我有一个HC-05,带有3.0-20170601,昨晚我设法将其绑定到一个奴隶.事实证明,v3具有两种AT模式.

I have a HC-05 with 3.0-20170601 that I managed to bind to a slave last night. It turns out that the v3 has two AT-modes.

第一个是在连接电源时按住按钮时.指示灯将缓慢闪烁,您可以以38400的波特率连接.但这就像配置模式,其中AT + INQ不可用.

The first is when you hold the button while you connect power. The led will blink slowly and you can connect at 38400 baud. But this is like a configuration mode, where AT+INQ is not available.

在这种模式下,我执行了以下命令:

In this mode I did these commands:

AT
AT+UART
AT+RMAAD
AT+ROLE=1

(按住按钮)

AT+RESET

(重新启动设备并导致LED缓慢闪烁后释放按钮)

(Release the button after device restarts and led is slowly blinking)

AT+CMODE=1
AT+INQM=0,5,5
AT+PSWD="9999"

AT应该给出OK作为答案,以了解连接是否正常

AT should give OK as answer to know connection is working

AT + UART将显示配置的波特率.默认值为9600.

AT+UART will show configured baudrate. Default is 9600.

AT + RMAAD清除所有已保存的连接

AT+RMAAD clears all saved connections

AT + ROLE = 1将其设置为主控

AT+ROLE=1 sets it as master

AT + RESET重新启动设备以更改为主设备

AT+RESET restarts the device to change to master

AT + CMODE = 1接受各种设备

AT+CMODE=1 accepts all kinds of devices

AT + INQM = 0,5,5在标准模式下查询,最大连接数为5或5秒

AT+INQM=0,5,5 inquires in standard mode, with 5 max connections or 5 secs

AT + PSWD ="9999"设置密码9999,更改为所需的密码

AT+PSWD="9999" sets the pin code 9999, change to the pin you need

此后,是时候更新arudino代码,使其连接到配置的波特率了.就像

After this it is time to update the arudino code so that it connects to the configured baud rate. It will be something like

BTSerial.begin(9600);

...或者您可能已将波特率设置为什么值.然后刷新您的arduino.

...or what ever value you might have set the baud rate to. Then reflash your arduino.

现在进入非常令人讨厌的第二个AT命令模式.

Now enter the very irritating second AT command mode.

在不按住按钮的情况下加电.您将获得快速的眨眼速度.开机时,按住按钮.指示灯将继续快速闪烁,但是在按下按钮时,您现在可以按配置的波特率连接到设备.因此,打开串行监视器并键入AT进行验证. 请记住,只有在按下按钮时该模式才有效.因此,请保持按下状态.我在上面放了一个小夹子.

Power up without holding the button. You will get the fast blink speed. When its powered up, press and hold the button. The led will continue blinking fast, but while the button is pressed you can now connect to the device on the configured baud rate. So open the serial monitor and type AT to verify. Remember that the mode is only active while the button is pressed. So keep it pressed. I had a small clamp I put on there.

然后我输入了以下命令:

Then I entered these commands:

AT+STATE

AT + STATE将显示当前状态,应查询

AT+STATE will show current state, should be inquiring

然后打开从属设备的电源,并且地址应开始弹出.就像xyz:xy:xyzw,931F00,7FFF

Then power up the slave device and the adress should start popping up. It will be something like xyz:xy:xyzw,931F00,7FFF

第一部分是您想要的地址(xyz:xy:xyzw)

The first part is the address you want (xyz:xy:xyzw)

将更改为,并获取xyz,xy,xyzw

Change : to , and get xyz,xy,xyzw

检查您是否连接到正确的设备

Check that you connecting to the correct device

AT+RNAME?xyz,xy,xyzw

然后绑定

AT+PAIR=xyz,xy,xyzw,5
AT+BIND=xyz,xy,xyzw
AT+LINK=xyz,xy,xyzw

AT + LINK命令给我FAIL作为输出.但这没关系. 我重新启动,之前或之后没有按任何按钮.只是正常的开始.

The AT+LINK command gave me FAIL as output. But it did not matter. I restarted and did not press any button before or after. Just normal start.

5-10秒后,串行数据显示在我的串行监视器中.

After 5-10s serial data showed up in my serial monitor.

模块已绑定.并会在开机时自动连接.如果没有,您可能输入了错误的密码.确保将上面的9999更改为0000或1234或任何其他可能的值.当我输入了错误的引脚时,我仍然可以从AT + PAIR和AT + BIND命令中得到确认...直到我输入正确的引脚,它对我来说都是无效的.

Modules are bound. And will automatically connect at power up. If not you might have the wrong pincode. Make sure to change 9999 above to 0000 or 1234 or what ever it may be. When I hade the wrong pin I still got OK from the AT+PAIR and AT+BIND commands... It didnt work for me until I entered the correct pin.

很抱歉发布了很长的帖子,但由于互联网上目前非常缺少关于HC-05 v3的信息,因此我想彻底讲解.

Sorry for long post, but I wanted to be thorough since info about HC-05 v3 is very scarce on the internet right now.

可以在这里找到对所有命令的参考: http://www.electronicaestudio.com/docs/istd016A.pdf (链接有效期至2018-08-13)

A reference to all commands can be found here: http://www.electronicaestudio.com/docs/istd016A.pdf (Link valid 2018-08-13)

这篇关于蓝牙HC-05仅针对INQ命令发送错误1F的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆