通过蓝牙将字符串从 Arduino 发送到 Windows Store App?
Send a string from Arduino to Windows Store App via Bluetooth?
我正在尝试获取一个 Unity3d Windows 商店应用程序游戏来读取通过蓝牙从 Arduino Uno Rev3 发送的一串文本。
不幸的是,Windows Store App 平台不允许使用System.IO.Ports 命名空间,所以我不确定如何让它读取蓝牙数据。
有人知道如何在 Windows Store 应用程序中从蓝牙读取数据吗?
感谢任何帮助,
谢谢
如果您的 HC-06 具有 COM 端口功能,那么您可以使用:[https://docs.microsoft.com/en-us/uwp/api/windows.devices.serialcommunication
Github:
上有一个样本
[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/SerialArduino
要了解您的设备是否在 windows 10 上具有 COM 端口功能,请转到 settings/Bluetooth,配对设备并转到更多设置,选择 com 端口并尝试添加端口。不幸的是,如果列表为空,您将无法使用 Windows.Devices.SerialCommunication API 与 Arduino 设备通信。
另一种方式是使用蓝牙GATT协议进行通信。
它允许您读取和写入数据并订阅以指示和通知事件。
为此,github 上还有一个示例:
[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLEClient
这取决于您的 HC-06 有哪些 Gatt 服务可用,但很可能有一种服务可以读取、写入和获取通知。
希望对你有帮助,
格罗弗
我最终使用了基于此示例的 BLE 解决方案:
https://www.simplicity.be/article/eddy-and-his-stones-diy-arduino-beacon-mobile-apps/
我正在尝试获取一个 Unity3d Windows 商店应用程序游戏来读取通过蓝牙从 Arduino Uno Rev3 发送的一串文本。
不幸的是,Windows Store App 平台不允许使用System.IO.Ports 命名空间,所以我不确定如何让它读取蓝牙数据。
有人知道如何在 Windows Store 应用程序中从蓝牙读取数据吗?
感谢任何帮助,
谢谢
如果您的 HC-06 具有 COM 端口功能,那么您可以使用:[https://docs.microsoft.com/en-us/uwp/api/windows.devices.serialcommunication Github:
上有一个样本[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/SerialArduino
要了解您的设备是否在 windows 10 上具有 COM 端口功能,请转到 settings/Bluetooth,配对设备并转到更多设置,选择 com 端口并尝试添加端口。不幸的是,如果列表为空,您将无法使用 Windows.Devices.SerialCommunication API 与 Arduino 设备通信。
另一种方式是使用蓝牙GATT协议进行通信。 它允许您读取和写入数据并订阅以指示和通知事件。 为此,github 上还有一个示例: [https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLEClient
这取决于您的 HC-06 有哪些 Gatt 服务可用,但很可能有一种服务可以读取、写入和获取通知。 希望对你有帮助,
格罗弗
我最终使用了基于此示例的 BLE 解决方案:
https://www.simplicity.be/article/eddy-and-his-stones-diy-arduino-beacon-mobile-apps/