nicolasdb / M5Stamp-C3U

This is an example PlatformIO project for M5Stamp C3
The Unlicense
1 stars 0 forks source link

AM2320 #5

Open nicolasdb opened 2 years ago

nicolasdb commented 2 years ago

https://github.com/adafruit/Adafruit_AM2320

I have a bad feeling that it will not work either because the same I2C problem as ADXL345 #4 Adafruit made this "Unified sensor" lib and it mess with ESP32C3 I2C. This is why I went back to use a simple DHT11 without I2C.

But let's try again.

nicolasdb commented 2 years ago

@ param the I2C Optional pointer to a TwoWire object that should be used for I2C communication. Defaults to &Wire.

So all you have to do is set the I2C SDA and I2C SCL variables to your selected SDA and SCL GPIOs. However, if you’re using libraries to interface with those sensors, this may not work, and selecting alternative pins may be difficult. This arises because if you don’t pass your own Wire instance while initialising the library, those libraries may overwrite your pins. In certain circumstances, we’ll need to look at the.CPP library files closely to figure out how to pass your own TwoWire arguments.

AM2320 work well whitout the need of TwoWire. Just add Wire.begin(SDA, SCL); in the setup.

But problem with Adafruit_AM2320 Humidity return "NaN" (Not a Number)

This one work well, https://github.com/RobTillaart/AM232X