Skip to content

Commit ce5ea2d

Browse files
committed
读取数据前增加延时
1 parent 3f8d968 commit ce5ea2d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

i2c_aht10_sample.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ static void read_temp_humi(float *cur_temp, float *cur_humi)
7979
rt_uint8_t temp[6];
8080

8181
write_reg(i2c_bus, AHT10_GET_DATA, 0); /* 发送命令 */
82-
read_regs(i2c_bus, 6, temp); /* 获取传感器数据 */
82+
rt_thread_mdelay(400);
83+
read_regs(i2c_bus, 6, temp); /* 获取传感器数据 */
8384

8485
/* 湿度数据转换 */
8586
*cur_humi = (temp[1] << 12 | temp[2] << 4 | (temp[3] & 0xf0) >> 4) * 100.0 / (1 << 20);

0 commit comments

Comments
 (0)