Bluetooth: Peripheral / Health Thermometer sensor¶
2 环境要求¶
board: 支持 BLE 的蓝牙设备
uart(option): 用来显示串口log
测试软件: nRF Connect
3 编译和烧录¶
例程位置:zephyr\samples_panchip\bluetooth\peripheral_ht
使用 ZAL 工具可以对其进行编译、烧录、打开 VS Code 调试等操作。关于 ZAL 工具的详细介绍请参考:Zephyr APP Launcher 工具介绍。
4 演示说明¶
烧录完成后,设备自动启动蓝牙广播,可以在手机或抓包工具上获取如下信息:
Service UUID: 0x1809, 0x180A, 0x180F
Device Name: Zephyr Health Thermometer
当手机或其它主设备与其建立连接后,串口log 会显示连接信息,如下:
Connected
此时,如果使能了
Temperature Measurement
,主机将收到温度数据,如下:串口log也会显示当前温度和数据传输的信息:
temperature is 20C Indication success Indication complete temperature is 21C Indication success Indication complete temperature is 22C Indication success Indication complete temperature is 23C Indication success Indication complete temperature is 24C Indication success Indication complete temperature is 25C Indication success Indication complete temperature is 26C Indication success Indication complete temperature is 27C Indication success Indication complete
5 RAM/Flash资源使用情况¶
Memory region Used Size Region Size %age Used
FLASH: 114692 B 256 KB 43.75%
SRAM: 31176 B 50 KB 60.89%