本帖最后由 damiaa 于 2023-7-29 22:11 编辑
【STM32WBA52CG】+2 STM32WBA Web Bluetooth试玩
【NUCLEO-WBA52CG】+1开箱贴 之后继续
Web Bluetooth 是基于低功耗蓝牙(BLE)来操作的,Web Bluetooth API 只支持低功耗蓝牙(LE)设备,这种蓝牙通信方式能够在较小范围内进行低功耗数据传输,通常用于物联网设备的连接。
Web Bluetooth应用程序能够与低功耗蓝牙设备进行连接,检测设备名称、服务、读写属性等完成对这些属性的读写操作,Web Bluetooth API 为 Web 应用程序开发者提供了一种直接与蓝牙设备交互的方式,从而不再
需要依赖于原生应用程序来进行蓝牙通信。
STM32WBA Web Bluetooth® App Interfaces
STM32WBA Web Bluetooth App 界面
https://applible.github.io/Web_Bluetooth_App_WBA/
nucleo-STM32WBA52CG开发板出厂就烧录了Peer To Peer Server固件,如果抹掉了也可以自己编译一个烧录进去,具体可以使用stm32cubeide生成项目和编译烧录。可以参考下面的例子:
..\stm32wb52ba\STM32CubeWBA-main\STM32CubeWBA-main\Projects\NUCLEO-WBA52CG\Applications\BLE\BLE_p2pServer
现在开始演示一下STM32WBA Web Bluetooth的使用
打开https://applible.github.io/Web_Bluetooth_App_WBA/
页面如下:nucleo-STM32WBA52CG开发板通电
点击connect 发现:P2PS_WBAxx设备,点击配对
如下:还可以查看一下信息
连接后显示如下:点击P2PServer
进入:P2PServer页面 就可以操作LightON 点灯,蓝牙板的灯会跟着亮别灭
如果 测试Notify 可以按Notify OFF 到Notify ON 然后按板子上的B1 Notify ON下面的灯会变化
- On p2pClient device, click on button B1 to launch a scan. A connection is initiated if a p2pServer device is detected.
- On p2pServer device, click on button B1 to send a notification message toward connected p2pClient device.
- On p2pClient device, click on button B1, to write a message toward connected p2pServer device.
- Adertising is stopped after 60s, button B1 click allows to restart it.
- When not connected, button B2 click allows to clear security database.
- Once connected, button B3 click allows to update connection interval parameters.
我们也可以用st ble tool在手机上操作它:因为没有google play因此没能下载成功,暂时就不试了。
关于Nucleo-STM32WBACCGC固件:STMWBA P2P Server的例子 下次继续