我将 RedBearLab BLE 屏蔽连接到 Arduino UNO R3。我可以使用 Rasp-Pi(附加的 CSR4.0 加密狗)中的 gatttool 连接到它。我有一些传感器(FSR)连接到模拟引脚,LED 连接到 Arduino 中的数字引脚。我的目标是读/写任何通过 BLE 连接到 Arduino 的东西。
作为示例,我正在查看此链接。看来我需要知道传感器的句柄、配置寄存器#等才能读/写。但我不确定如何找到与连接到屏蔽的传感器相关的句柄/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,如下工作
字符写入命令 0x000b 010100
同样,要打开传感器读取功能,我需要在下面写
字符写入命令 0x000b A00100
我知道这行得通。我在 Arduino 串行监视器中看到了预期的输出。我很确定它正在读取传感器,但我在 RaspPi 提示中看不到它。我想我需要在 RaspPi 端启用广播阅读功能。
有什么建议吗?