printf('Temperature: %.1f, Humidity: %.1f.
', aht_temper, aht_humi);

if (status != HI_ERR_SUCCESS)
{
    printf('Get data error!
');
}

hi_sleep(AHT_SLEEP_50MS);

代码注释内容:

  • 代码使用 printf 函数打印当前的温度和湿度数据。
  • 使用 if 语句判断数据获取状态 status 是否为成功 (HI_ERR_SUCCESS)。
  • 如果状态不是成功,则使用 printf 函数打印错误信息 'Get data error!'。
  • 最后使用 hi_sleep 函数让程序暂停 50 毫秒。

原文地址: http://www.cveoy.top/t/topic/irn5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录