BLE - UART DHT 功能
材料准备
AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1
DHT11 or DHT22 or DHT21
Android / iOS 智能手机
范例说明
介绍
在此范例中,从DHT温度和湿度传感器获得的数据通过BLE UART服务传输到手机。有关使用DHT传感器和BLE UART服务的详细说明,请参阅其他范例。
流程
如下图,将DHT传感器连接到Ameba板上。
AMB21 / AMB22:
AMB23:
BW16:
BW16-TypeC:
确保您的手机上已安装兼容的BLE UART应用程序,该应用程序可在以下位置获得:
– Google Play Store: https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal
– Apple App Store: https://apps.apple.com/us/app/bluefruit-connect/id830125974
Open the example, “Files” → “Examples” → “AmebaBLE” →
“DHT_over_BLEUart”
.
Upload the code and press the reset button on Ameba once the upload is finished. Open the app on your smartphone, scan and connect to the Ameba board shown as “AMEBA_BLE_DEV” and choose the UART function in the app.
启动UART功能后,应每5秒钟收到包含所测温度和湿度的通知。