【发布时间】:2014-02-16 04:45:53
【问题描述】:
我将 RedBearLab BLE 扩展板连接到 Arduino UNO R3。我可以使用 Rasp-Pi(附加的 CSR4.0 加密狗)中的 gatttool 连接到它。我有一些传感器(FSR)连接到模拟引脚,LED 连接到 Arduino 中的数字引脚。我的目标是读/写任何通过 BLE 连接到 Arduino 的东西。
作为示例,我正在研究这个link。似乎我需要知道传感器的句柄、配置寄存器#等才能读/写。但我不确定如何找到与连接到屏蔽的传感器相关的句柄/uuid。
例如我在下面看到的。
[xx:xx:xx:xx:xx:xx][LE]> char-desc
handle: 0x0001, uuid: 2800
handle: 0x0002, uuid: 2803
handle: 0x0003, uuid: 2a00
handle: 0x0004, uuid: 2803
handle: 0x0005, uuid: 2a01
handle: 0x0006, uuid: 2803
handle: 0x0007, uuid: 2a04
handle: 0x0008, uuid: 2800
handle: 0x0009, uuid: 2800
handle: 0x000a, uuid: 2803
handle: 0x000b, uuid: 713d0003-503e-4c75-ba94-3148f18d941e
handle: 0x000c, uuid: 2803
handle: 0x000d, uuid: 713d0002-503e-4c75-ba94-3148f18d941e
handle: 0x000e, uuid: 2902
handle: 0x000f, uuid: 2800
handle: 0x0010, uuid: 2803
handle: 0x0011, uuid: 2a27
Discover descriptors finished: No attribute found within the given range
[xx:xx:xx:xx:xx:xx][LE]> char-read-hnd 0x0001
Characteristic value/descriptor: 00 18
[xx:xx:xx:xx:xx:xx][LE]> char-read-hnd 0x000b
Error: Characteristic value/descriptor read failed: Attribute can't be read
我怎么知道哪一个是我贴在盾牌上的 FSR?
更新
我正在使用 RedBearLab 示例 - simplecontrol
所以 Arduino 和 iOS/Android 代码都在那里。我的目标是从 gatttool 的角度理解,以便我可以在 Raspberry Pi 上运行的 Java 中开发类似的(iOS/Android)。
从代码中,我可以确定要写哪个地址。例如 - 打开连接到数字输出引脚的 LED,如下工作
char-write-cmd 0x000b 010100
同样,要开启传感器读取能力,我需要写在下面
char-write-cmd 0x000b A00100
我知道这行得通。我在 Arduino 串行监视器中看到了预期的输出。我很确定它正在读取传感器,但我在 RaspPi 提示中看不到它。我想我需要在 RaspPi 端启用广播读取功能。
有什么建议吗?
【问题讨论】:
-
嗯,BLE Shield 库的问题在于它们在 GATT 上添加了一个抽象层。他们使用 GATT 来公开用作某种“虚拟 UART”的特性,因此他们可以在其中传递自己的汤。但是,我不太了解
gatttool,因为我没有用它来处理BLE。我主要在 OSX 上使用LightBlue.app。 -
已解决并发布在我的lilyhack.wordpress.com/2014/02/03/…
标签: bluetooth arduino bluetooth-lowenergy bluez