Bluetooth: Peripheral / Health Thermometer sensor¶
2 环境要求¶
board: 支持 BLE 的蓝牙设备
uart(option): 用来显示串口log
测试软件: nRF Connect
3 编译和烧录¶
项目位置:zephyr\samples_panchip\bluetooth\peripheral_ht
目前可使用ZAL工具或quick build脚本进行编译和下载。
脚本位置:quick_build_samples\bluetooth\peripheral_ht.bat
。
打开脚本后默认会编译项目,编译完成时,可输入字符进行后续下载等操作:
Input the keyword to continue:
'b' build 编译项目
'r' make clean and rebuild 重新编译项目
'f' flash download 下载
'e' erase chip 擦除芯片
'o' open project by VS Code 打开 `VS Code`,可查看源码,执行编译下载等
others exit 退出
wait input:
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