Air-duino / Arduino-AirMCU

Arduino core for the Air MCU.
https://arduino.luatos.com/
MIT License
70 stars 21 forks source link

air001 使用Adafruit_AHTX0 在begin时卡住 #54

Closed bbllmaster closed 1 year ago

bbllmaster commented 1 year ago

描述一下这个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

image

日志 / Logs

Adafruit AHT10/AHT20 demo!

系统 / System

air001

PACK包版本 / Version

0.41

验证

createskyblue commented 1 year ago

i2c master有问题,着急的话建议先软件I2C