Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
dht11
瑞萨_RA6M4
【Renesas RA6M4开发板之DHT11温湿度读取】
发布于 2022-07-16 19:49:16 浏览:1183
订阅该版
[tocm] # 1.0 DHT11 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/ec31208b6def50f2148c9102da059b6acf47c20e.png) **此图转载telesky旗舰店** *本篇通过Renesas RA6M4开发板DHT11温湿度读取示例程序演示。* ## 1.1 DHT11介绍 DHT11数字温湿度传感器是一款含有已校准数字信号输出的温湿度复合传感器。它应用专用的数字模块采集技术和温湿度传感技术,确保产品具有可靠性与卓越的长期稳定性,成本低、相对湿度和温度测量、快响应、抗干扰能力强、信号传输距离长、数字信号输出、精确校准。传感器包括一个电容式感湿元件和一个NTC测温元件,并与一个高性能8位单片机相连接。 可用于暖通空调、除湿器、测试及检测设备、消费品、汽车、自动控制、数据记录器、气象站、家电、湿度调节器、医疗、其他相关湿度检测控制。 ## 1.2 DHT11特点 1、相对湿度和温度一体测量 2、全量程标定。无需重新标定即可互换使用 3、快响应时间 4、单线制数字接回(简单的系统集成,低的价格) 5、高可靠性 6、优化的长期稳定性 7、抗手扰能力强8信号传输距离长 8、需在气体环境中工作,不可测量液体和反接电源😅😅😅 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/2fd328b3c28c11e1df58de618d6dba41d68296f9.png) 尺寸大小如下: ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/ff3d127a3bd4255e85bfeb3a47663116318b1a5d.png) ## 1.3 产品应用 - 暖通空调除湿器 - 测试及检测设备测试及检测设备·汽车 - 数据记录器消费品 - 自动控制。气象站 # 2. RT-theard配置 ## 2.1 硬件需求 1、dht11测量当前气体环境的温度和湿度,采用单线传输,接P102 > 实现功能: >dht11测量当前气体环境的温度和湿度 2、RA6M4开发板 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/666c70553be11f37c54e2fd5b12b1dd1dae10084.png) 3、USB下载线,ch340串口和附带5根母母线,**rx---p613;tx---p614** ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/d00afb6b5cd0c3774cb9dbeb612b4167065f2b16.png) ## 2.2 软件配置 Renesas RA6M4开发板环境配置参照:[【基于 RT-Thread Studio的CPK-RA6M4 开发板环境搭建】](https://blog.csdn.net/vor234/article/details/125634313) 1、新建项目RA6M4-dht11工程 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/2103c249534f618576ad1a49ef57eb31f4cf8c59.png) 2、点击RT-theard Setting,在软件包下添加软件包,然后搜索dht相关软件支持包选择`dhtxx`,点击添加即可,然后出现对应包。 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/2350d9813d6d227c0bef0a0ea4661bb093f4ce06.png) 3、配置`dhtxx`,右键选择配置项 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/8f8ccb8ebc1aa99d8014d606181a7c795aef99e6.png) 4、在软件包中开启示例程序。 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/549a9b63161574f6ac6db369777cb45013ca895d.png) 5、在`Smart Configuration`中配置P102引脚为`Input mode` ![screenshot_image.png](https://oss-club.rt-thread.org/uploads/20220718/f409318bb515980ef0d3fc2aba0007dd.png.webp) 6、全部保存刚刚的配置,更新当前配置文件 **保存完是灰色,没有保存是蓝色。** # 3. 代码分析 1、刚刚加载软件包在packages文件夹下,修改三处`.c`文件, > dhtxx_latest的example文件夹下的`dhtxx_sample.c` > dhtxx_latest的src文件夹下的`dhtxx.c`和`sensor_asair_dhtxx.c` 示例代码更改为如下 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/a9ef3a610aa72d8d42b8e8a0ea9a9d17a2e02e35.png) (更改内容头文件添加`#include "bsp_api.h"`,端口设置为`BSP_IO_PORT_01_PIN_02`,然后删除微秒`us`定时器)😅😅😅 `dhtxx_sample.c` ```cpp /* * Copyright (c) 2020, RudyLo
* * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2020-01-20 luhuadong the first version * 2020-10-05 luhuadong v0.9.0 */ #include
#include
#include
#include "dhtxx.h" #include "hal_data.h" #define DATA_PIN BSP_IO_PORT_01_PIN_02 /* cat_dhtxx sensor data by dynamic */ static void cat_dhtxx(void) { dht_device_t sensor = dht_create(DATA_PIN); if(dht_read(sensor)) { rt_int32_t temp = dht_get_temperature(sensor); rt_int32_t humi = dht_get_humidity(sensor); rt_kprintf("Temp: %d.%d 'C, Humi: %d '% \n", temp/10, temp%10, humi/10); } else { rt_kprintf("Read dht sensor failed.\n"); } dht_delete(sensor); } #ifdef FINSH_USING_MSH MSH_CMD_EXPORT(cat_dhtxx, read dhtxx humidity and temperature); #endif ``` `dhtxx.c` ```cpp /* * Copyright (c) 2020, RudyLo
* * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2020-01-20 luhuadong the first version */ #include
#include "dhtxx.h" #include "bsp_api.h" #define DBG_TAG "sensor.asair.dhtxx" #ifdef PKG_USING_DHTXX_DEBUG #define DBG_LVL DBG_LOG #else #define DBG_LVL DBG_ERROR #endif #include
/* timing */ #define DHT1x_BEGIN_TIME 20 /* ms */ #define DHT2x_BEGIN_TIME 1 /* ms */ #define DHTxx_PULL_TIME 30 /* us */ #define DHTxx_REPLY_TIME 100 /* us */ #define MEASURE_TIME 40 /* us */ /** * This function will split a number into two part according to times. * * @param num the number will be split * @param integer the integer part * @param decimal the decimal part * @param times how many times of the real number (you should use 10 in this case) * * @return 0 if num is positive, 1 if num is negative */ int split_int(const int num, int *integer, int *decimal, const rt_uint32_t times) { int flag = 0; if (num < 0) flag = 1; int anum = num<0 ? -num : num; *integer = anum / times; *decimal = anum % times; return flag; } /** * This function will convert temperature in degree Celsius to Kelvin. * * @param c the temperature indicated by degree Celsius * * @return the result */ float convert_c2k(float c) { return c + 273.15; } /** * This function will convert temperature in degree Celsius to Fahrenheit. * * @param c the temperature indicated by degree Celsius * * @return the result */ float convert_c2f(float c) { return c * 1.8 + 32; } /** * This function will convert temperature in degree Fahrenheit to Celsius. * * @param f the temperature indicated by degree Fahrenheit * * @return the result */ float convert_f2c(float f) { return (f - 32) * 0.55555; } /** * This function will read a bit from sensor. * * @param pin the pin of Dout * * @return the bit value */ static uint8_t dht_read_bit(const rt_base_t pin) { uint8_t retry = 0; while(rt_pin_read(pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); } retry = 0; while(!rt_pin_read(pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); } rt_hw_us_delay(MEASURE_TIME); return rt_pin_read(pin); } /** * This function will read a byte from sensor. * * @param pin the pin of Dout * * @return the byte */ static uint8_t dht_read_byte(const rt_base_t pin) { uint8_t i, byte = 0; for(i=0; i<8; i++) { byte <<= 1; byte |= dht_read_bit(pin); } return byte; } /** * This function will read and update data array. * * @param dev the device to be operated * * @return RT_TRUE if read successfully, otherwise return RT_FALSE. */ rt_bool_t dht_read(dht_device_t dev) { RT_ASSERT(dev); uint8_t i, retry = 0, sum = 0; #ifdef PKG_USING_DHTXX_INTERRUPT_DISABLE rt_base_t level; #endif /* Reset data buffer */ rt_memset(dev->data, 0, DHT_DATA_SIZE); /* MCU request sampling */ rt_pin_mode(dev->pin, PIN_MODE_OUTPUT); rt_pin_write(dev->pin, PIN_LOW); if (dev->type == DHT11 || dev->type == DHT12) { rt_thread_mdelay(DHT1x_BEGIN_TIME); /* Tbe */ } else { rt_thread_mdelay(DHT2x_BEGIN_TIME); } #ifdef PKG_USING_DHTXX_INTERRUPT_DISABLE level = rt_hw_interrupt_disable(); #endif rt_pin_mode(dev->pin, PIN_MODE_INPUT_PULLUP); rt_hw_us_delay(DHTxx_PULL_TIME); /* Tgo */ /* Waiting for sensor reply */ while (rt_pin_read(dev->pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); /* Trel */ } if(retry >= DHTxx_REPLY_TIME) return RT_FALSE; retry = 0; while (!rt_pin_read(dev->pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); /* Treh */ }; if(retry >= DHTxx_REPLY_TIME) return RT_FALSE; /* Read data */ for(i=0; i
data[i] = dht_read_byte(dev->pin); } #ifdef PKG_USING_DHTXX_INTERRUPT_DISABLE rt_hw_interrupt_enable(level); #endif /* Checksum */ for(i=0; i
data[i]; } if(sum != dev->data[4]) return RT_FALSE; return RT_TRUE; } /** * This function will get the humidity from dhtxx sensor. * * @param dev the device to be operated * * @return the humidity value */ rt_int32_t dht_get_humidity(dht_device_t const dev) { RT_ASSERT(dev); rt_int32_t humi = 0; switch(dev->type) { case DHT11: case DHT12: humi = dev->data[0] * 10 + dev->data[1]; break; case DHT21: case DHT22: humi = (dev->data[0] << 8) + dev->data[1]; break; default: break; } return humi; } /** * This function will get the temperature from dhtxx sensor. * * @param dev the device to be operated * * @return the temperature value */ rt_int32_t dht_get_temperature(dht_device_t const dev) { RT_ASSERT(dev); rt_int32_t temp = 0; switch(dev->type) { case DHT11: case DHT12: temp = dev->data[2] * 10 + (dev->data[3] & 0x7f); if(dev->data[3] & 0x80) { temp = -temp; } break; case DHT21: case DHT22: temp = ((dev->data[2] & 0x7f) << 8) + dev->data[3]; if(dev->data[2] & 0x80) { temp = -temp; } break; default: break; } return temp; } /** * This function will init dhtxx sensor device. * * @param dev the device to init * @param pin the pin of Dout * * @return the device handler */ rt_err_t dht_init(struct dht_device *dev, const rt_base_t pin) { if(dev == NULL) return -RT_ERROR; dev->type = DHT_TYPE; dev->pin = pin; rt_memset(dev->data, 0, DHT_DATA_SIZE); rt_pin_mode(dev->pin, PIN_MODE_INPUT_PULLUP); return RT_EOK; } dht_device_t dht_create(const rt_base_t pin) { dht_device_t dev; dev = rt_calloc(1, sizeof(struct dht_device)); if (dev == RT_NULL) { LOG_E("Can't allocate memory for dhtxx device"); return RT_NULL; } dev->type = DHT_TYPE; dev->pin = pin; rt_memset(dev->data, 0, DHT_DATA_SIZE); rt_pin_mode(dev->pin, PIN_MODE_INPUT_PULLUP); return dev; } void dht_delete(dht_device_t dev) { if (dev) rt_free(dev); } ``` `sensor_asair_dhtxx.c` ```cpp /* * Copyright (c) 2020, RudyLo
* * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2020-02-17 luhuadong the first version */ #include
#include "dhtxx.h" #include "bsp_api.h" #define DBG_TAG "sensor.asair.dhtxx" #ifdef PKG_USING_DHTXX_DEBUG #define DBG_LVL DBG_LOG #else #define DBG_LVL DBG_ERROR #endif #include
/* timing */ #define DHT1x_BEGIN_TIME 20 /* ms */ #define DHT2x_BEGIN_TIME 1 /* ms */ #define DHTxx_PULL_TIME 30 /* us */ #define DHTxx_REPLY_TIME 100 /* us */ #define MEASURE_TIME 40 /* us */ /* range by ten times */ #define SENSOR_HUMI_RANGE_MIN 0 #define SENSOR_HUMI_RANGE_MAX 1000 #define SENSOR_TEMP_RANGE_MIN -400 #define SENSOR_TEMP_RANGE_MAX 800 /* minial period (ms) */ #define SENSOR_PERIOD_MIN 1000 #define SENSOR_HUMI_PERIOD_MIN SENSOR_PERIOD_MIN #define SENSOR_TEMP_PERIOD_MIN SENSOR_PERIOD_MIN /* fifo max length */ #define SENSOR_FIFO_MAX 1 #define SENSOR_HUMI_FIFO_MAX SENSOR_FIFO_MAX #define SENSOR_TEMP_FIFO_MAX SENSOR_FIFO_MAX static char *const dht_model_table[] = { "dht11", "dht12", "dht21", "dht22" }; RT_WEAK void rt_hw_us_delay(rt_uint32_t us) { rt_uint32_t delta; us = us * (SysTick->LOAD / (1000000 / RT_TICK_PER_SECOND)); delta = SysTick->VAL; while (delta - SysTick->VAL < us) continue; } /** * This function will read a bit from sensor. * * @param pin the pin of Dout * * @return the bit value */ static uint8_t _dht_read_bit(const rt_base_t pin) { uint8_t retry = 0; while(rt_pin_read(pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); } retry = 0; while(!rt_pin_read(pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); } rt_hw_us_delay(MEASURE_TIME); return rt_pin_read(pin); } /** * This function will read a byte from sensor. * * @param pin the pin of Dout * * @return the byte */ static uint8_t _dht_read_byte(const rt_base_t pin) { uint8_t i, byte = 0; for(i=0; i<8; i++) { byte <<= 1; byte |= _dht_read_bit(pin); } return byte; } /** * This function will read and update data array. * * @param sensor the sensor device to be operated * @param data read data * * @return RT_TRUE if read successfully, otherwise return RT_FALSE. */ static rt_bool_t _dht_read(struct rt_sensor_device *sensor, rt_uint8_t data[]) { RT_ASSERT(data); rt_base_t pin = (rt_base_t)sensor->config.intf.user_data; rt_uint8_t type = DHT_TYPE; uint8_t i, retry = 0, sum = 0; #ifdef PKG_USING_DHTXX_INTERRUPT_DISABLE rt_base_t level; #endif /* Reset data buffer */ rt_memset(data, 0, DHT_DATA_SIZE); /* MCU request sampling */ rt_pin_mode(pin, PIN_MODE_OUTPUT); rt_pin_write(pin, PIN_LOW); if (type == DHT11 || type == DHT12) { rt_thread_mdelay(DHT1x_BEGIN_TIME); /* Tbe */ } else { rt_thread_mdelay(DHT2x_BEGIN_TIME); } #ifdef PKG_USING_DHTXX_INTERRUPT_DISABLE level = rt_hw_interrupt_disable(); #endif rt_pin_mode(pin, PIN_MODE_INPUT_PULLUP); rt_hw_us_delay(DHTxx_PULL_TIME); /* Tgo */ /* Waiting for sensor reply */ while (rt_pin_read(pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); /* Trel */ } if(retry >= DHTxx_REPLY_TIME) { LOG_D("sensor reply timeout on low level"); return RT_FALSE; } retry = 0; while (!rt_pin_read(pin) && retry < DHTxx_REPLY_TIME) { retry++; rt_hw_us_delay(1); /* Treh */ }; if(retry >= DHTxx_REPLY_TIME) { LOG_D("sensor reply timeout on high level"); return RT_FALSE; } /* Read data */ for(i=0; i
info.model); return 0; } rt_uint32_t timestamp = rt_sensor_get_ts(); rt_int32_t temp = _dht_get_temperature(sensor, raw_data); rt_int32_t humi = _dht_get_humidity(sensor, raw_data); if (temp < SENSOR_TEMP_RANGE_MIN || temp > SENSOR_TEMP_RANGE_MAX || humi < SENSOR_HUMI_RANGE_MIN || humi > SENSOR_HUMI_RANGE_MAX ) { LOG_D("Data out of range"); return 0; } if (sensor->info.type == RT_SENSOR_CLASS_HUMI) { sensor_data->type = RT_SENSOR_CLASS_HUMI; sensor_data->data.humi = humi; sensor_data->timestamp = timestamp; struct rt_sensor_data *partner_data = (struct rt_sensor_data *)sensor->module->sen[1]->data_buf; if (partner_data) { partner_data->type = RT_SENSOR_CLASS_TEMP; partner_data->data.temp = temp; partner_data->timestamp = timestamp; sensor->module->sen[1]->data_len = sizeof(struct rt_sensor_data); } } else if (sensor->info.type == RT_SENSOR_CLASS_TEMP) { sensor_data->type = RT_SENSOR_CLASS_TEMP; sensor_data->data.temp = temp; sensor_data->timestamp = timestamp; struct rt_sensor_data *partner_data = (struct rt_sensor_data *)sensor->module->sen[0]->data_buf; if (partner_data) { partner_data->type = RT_SENSOR_CLASS_HUMI; partner_data->data.humi = humi; partner_data->timestamp = timestamp; sensor->module->sen[0]->data_len = sizeof(struct rt_sensor_data); } } return 1; } static rt_size_t dht_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len) { if (sensor->config.mode == RT_SENSOR_MODE_POLLING) { return _dht_polling_get_data(sensor, buf); } else return 0; } static rt_err_t dht_control(struct rt_sensor_device *sensor, int cmd, void *args) { rt_err_t result = RT_EOK; switch (cmd) { case RT_SENSOR_CTRL_GET_ID: break; case RT_SENSOR_CTRL_SET_MODE: sensor->config.mode = (rt_uint32_t)args & 0xFF; break; case RT_SENSOR_CTRL_SET_RANGE: break; case RT_SENSOR_CTRL_SET_ODR: break; case RT_SENSOR_CTRL_SET_POWER: break; case RT_SENSOR_CTRL_SELF_TEST: break; default: break; } return result; } static struct rt_sensor_ops sensor_ops = { dht_fetch_data, dht_control }; /** * This function will init dhtxx sensor device. * * @param intf interface * * @return RT_EOK */ static int sensor_init(rt_base_t pin) { rt_pin_mode(pin, PIN_MODE_INPUT_PULLUP); return RT_EOK; } /** * Call function rt_hw_dht_init for initial and register a dhtxx sensor. * * @param name the name will be register into device framework * @param cfg sensor config * * @return the result */ rt_err_t rt_hw_dht_init(const char *name, struct rt_sensor_config *cfg) { int result; rt_sensor_t sensor_temp = RT_NULL, sensor_humi = RT_NULL; struct rt_sensor_module *module = RT_NULL; if (sensor_init((rt_base_t)cfg->intf.user_data) != RT_EOK) { LOG_E("dhtxx sensor init failed"); result = -RT_ERROR; goto __exit; } module = rt_calloc(1, sizeof(struct rt_sensor_module)); if (module == RT_NULL) { result = -RT_ENOMEM; goto __exit; } /* humidity sensor register */ { sensor_humi = rt_calloc(1, sizeof(struct rt_sensor_device)); if (sensor_humi == RT_NULL) { result = -RT_ENOMEM; goto __exit; } sensor_humi->info.type = RT_SENSOR_CLASS_HUMI; sensor_humi->info.vendor = RT_SENSOR_VENDOR_ASAIR; sensor_humi->info.model = dht_model_table[DHT_TYPE]; sensor_humi->info.unit = RT_SENSOR_UNIT_PERMILLAGE; sensor_humi->info.intf_type = RT_SENSOR_INTF_ONEWIRE; sensor_humi->info.range_max = SENSOR_HUMI_RANGE_MAX; sensor_humi->info.range_min = SENSOR_HUMI_RANGE_MIN; sensor_humi->info.period_min = SENSOR_HUMI_PERIOD_MIN; sensor_humi->info.fifo_max = SENSOR_HUMI_FIFO_MAX; sensor_humi->data_len = 0; rt_memcpy(&sensor_humi->config, cfg, sizeof(struct rt_sensor_config)); sensor_humi->ops = &sensor_ops; sensor_humi->module = module; result = rt_hw_sensor_register(sensor_humi, name, RT_DEVICE_FLAG_RDWR, RT_NULL); if (result != RT_EOK) { LOG_E("device register err code: %d", result); result = -RT_ERROR; goto __exit; } } /* temperature sensor register */ { sensor_temp = rt_calloc(1, sizeof(struct rt_sensor_device)); if (sensor_temp == RT_NULL) { result = -RT_ENOMEM; goto __exit; } sensor_temp->info.type = RT_SENSOR_CLASS_TEMP; sensor_temp->info.vendor = RT_SENSOR_VENDOR_ASAIR; sensor_temp->info.model = dht_model_table[DHT_TYPE]; sensor_temp->info.unit = RT_SENSOR_UNIT_DCELSIUS; sensor_temp->info.intf_type = RT_SENSOR_INTF_ONEWIRE; sensor_temp->info.range_max = SENSOR_TEMP_RANGE_MAX; sensor_temp->info.range_min = SENSOR_TEMP_RANGE_MIN; sensor_temp->info.period_min = SENSOR_TEMP_PERIOD_MIN; sensor_temp->info.fifo_max = SENSOR_TEMP_FIFO_MAX; sensor_temp->data_len = 0; rt_memcpy(&sensor_temp->config, cfg, sizeof(struct rt_sensor_config)); sensor_temp->ops = &sensor_ops; sensor_temp->module = module; result = rt_hw_sensor_register(sensor_temp, name, RT_DEVICE_FLAG_RDWR, RT_NULL); if (result != RT_EOK) { LOG_E("device register err code: %d", result); result = -RT_ERROR; goto __exit; } } module->sen[0] = sensor_humi; module->sen[1] = sensor_temp; module->sen_num = 2; LOG_D("sensor init success"); return RT_EOK; __exit: if(sensor_humi) { if(sensor_humi->data_buf) rt_free(sensor_humi->data_buf); rt_free(sensor_humi); } if(sensor_temp) { if(sensor_temp->data_buf) rt_free(sensor_temp->data_buf); rt_free(sensor_temp); } if (module) rt_free(module); return result; } ``` 2、此库包含单总线读取温湿度信息,解调,添加CMD读取命令`cat_dhtxx` 关键打印代码以及自行校准两项参数 ```cpp if(dht_read(sensor)) { rt_int32_t temp = dht_get_temperature(sensor); rt_int32_t humi = dht_get_humidity(sensor); rt_kprintf("Temp: %d.%d 'C, Humi: %d '% \n", temp/10, temp%10, humi/10); } ``` 3、main.c文件在re_gen文件夹下,主程序围绕“hal_entry();”函数(在src文件夹),这些默认不变 # 4. 下载验证 1、编译重构 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/f80ef2bf11df591f4519d71bd39d9a54ad006f10.png) 编译成功 2、下载程序 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/c7ceb857dfac73cd891c6ca27ac1526cb0b85a13.png) 下载成功 3、CMD串口调试 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/6184c9825aed5d03ac96cf1a092775ed36dfc517.png) 然后板载复位,初始化成功,输入`cat_dhtxx`命令,开始串口打印温湿度显示!🎉🎉🎉 效果如下 ![在这里插入图片描述](https://oss-club.rt-thread.org/uploads/20220716/35f550243f743333a88aa022bfab4ed582d972f1.png) 这样我们就可以天马行空啦!![请添加图片描述](https://oss-club.rt-thread.org/uploads/20220716/bde92a578c517a7600208aa4971d4198dcace737.gif) 参考文献; [【基于 RT-Thread Studio的CPK-RA6M4 开发板环境搭建】](https://blog.csdn.net/vor234/article/details/125634313)
5
条评论
默认排序
按发布时间排序
登录
注册新账号
关于作者
2345vor
每天都满怀期待i😀
文章
20
回答
2
被采纳
0
关注TA
发私信
相关文章
1
急救,关于DHT11和DS18B20温度传感器
2
AB32VG1 导入DHT11软件包报错
3
AB32VG1 DHT1使用软件包初始化失败或找不到sersor
4
bh1750软件包bh1750.c文件里面光照强度是哪个数据?
5
rtt studio 2.2.4版本之前的软件包问题
6
K210-RT-DRACO 导入DHT11软件包报错“SysTick”未声明
7
添加软件包dht11出错
8
studio里我配置了dht11的软件包,实际保存编译后,目录里没有dht11
9
我想在OLED显示屏上显示温湿度数据,
10
v5.02,使用dht11软件包,会找不到”sensor.h“?
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
WIZnet_W5500
UART
ota在线升级
PWM
cubemx
freemodbus
flash
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
中断
Debug
编译报错
msh
SFUD
keil_MDK
rt_mq_消息队列_msg_queue
MicroPython
ulog
C++_cpp
本月问答贡献
踩姑娘的小蘑菇
7
个答案
3
次被采纳
a1012112796
15
个答案
2
次被采纳
张世争
9
个答案
2
次被采纳
rv666
5
个答案
2
次被采纳
用户名由3_15位
13
个答案
1
次被采纳
本月文章贡献
程序员阿伟
9
篇文章
2
次点赞
hhart
3
篇文章
4
次点赞
大龄码农
1
篇文章
5
次点赞
RTT_逍遥
1
篇文章
2
次点赞
ThinkCode
1
篇文章
1
次点赞
回到
顶部
发布
问题
投诉
建议
回到
底部