# I2C_AHT20 - 将PB6、PB7分别配置为I2C_SCL、I2C_SDA - 在Project Manager - Code Generator中勾选Generate peripheral initialization as a pair of... - 配置I2C1 - I2C选择I2C - 配置USART2为Asynchronous - 复制dht20.c/dht20.h文件到Core的Src/Inc目录下 - API - DHT20_Init() 初始化AHT20 - DHT20_Get_T_H 获取温湿度 - 注意:默认无法使用sprintf打印浮点数,需要在工程Properties - C/C++ Build - Settings - MCU Settings中,勾选Use float with printf from newlib -nano