if (! aht.begin(&Wire,1,AHTX0_I2CADDR_DEFAULT )) {
Serial.println("Could not find AHT? Check wiring");
while (1) delay(10);
}
Serial.println("AHT10 or AHT20 found");
}
void loop() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
delay(500);
}
`
打印出:
Adafruit AHT10/AHT20 demo!
如果正常,应该是什么样 / Expected behavior
打印AHT10 or AHT20 found
截图 / Screenshots
日志 / Logs
Adafruit AHT10/AHT20 demo!
系统 / System
air001
PACK包版本 / Version
0.41
验证
[X] 检查过该问题,之前没有人提过 / Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
描述一下这个bug / Describe the bug
Adafruit_AHTX0 库,初始化卡住,没返回true ,如果是找不到设备会快速失败,返回false的,同样的代码在esp32c3验证过可以跑的,不确实是不是内存不足了
复现步骤 / To Reproduce
代码如下 `
include
Adafruit_AHTX0 aht; void setup() { Wire.setSDA(PF_0); Wire.setSCL(PF_1); Wire.begin(); Serial.begin(9600); Serial.println("Adafruit AHT10/AHT20 demo!");
if (! aht.begin(&Wire,1,AHTX0_I2CADDR_DEFAULT )) { Serial.println("Could not find AHT? Check wiring"); while (1) delay(10); } Serial.println("AHT10 or AHT20 found"); }
void loop() { sensors_event_t humidity, temp; aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C"); Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
delay(500); }
`
打印出:
Adafruit AHT10/AHT20 demo!
如果正常,应该是什么样 / Expected behavior
打印AHT10 or AHT20 found
截图 / Screenshots
日志 / Logs
Adafruit AHT10/AHT20 demo!
系统 / System
air001
PACK包版本 / Version
0.41
验证