【发布时间】:2015-08-21 00:23:43
【问题描述】:
背景
我正在做一个项目,通过蓝牙(带有 HC-05 模块的 Arduino Uno)将 Android 应用程序与 Arduino 板连接起来。所以我从 Arduino 端开始开发,暂时使用 Play Store 上的蓝牙终端应用程序来模拟我必须传输的任何数据。现在我正在转向它的 Android 端。
当然,我直接使用了 BluetoothChat 示例 (https://developer.android.com/samples/BluetoothChat/index.html) 来抢占先机。在网上搜索,似乎只有一行更改应该是连接到我的 HC-05 模块的 BluetoothChat。
问题
所以我无法使用 HC-05 将我的 BluetoothChat 连接到 Arduino。 Arduino 项目应该可以工作,它可以很好地连接到 Play 商店中的各种蓝牙终端应用程序。
我对 BluetoothChat 示例所做的唯一更改是更改 BluetoothChatService.java 中的代码:
来自
// Unique UUID for this application
private static final UUID MY_UUID_SECURE =
UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
private static final UUID MY_UUID_INSECURE =
UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
到
// HC-05 UUID "00001101-0000-1000-8000-00805F9B34FB"
private static final UUID MY_UUID_SECURE =
UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
private static final UUID MY_UUID_INSECURE =
UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
我的印象是,我需要进行的唯一更改才能让我的 BluetoothChat 示例开始移动。类似这样的东西 (http://blog.onaclovtech.com/2012/04/modifying-bluetooth-chat.html),虽然它看起来是旧版本的 BluetoothChat。
任何帮助将不胜感激。谢谢!
【问题讨论】:
-
你为什么选择那个特定的 UUID ?随便在 HC-05 UUID 服务号中找到任何信息?
标签: android bluetooth arduino android-bluetooth