duino-coin icon indicating copy to clipboard operation
duino-coin copied to clipboard

Add AHTx sensor support to ESP8266 version

Open mmahdium opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. AHT sensor support in present in ESP32 version but it's not supported in ESP8266 version.

Describe the solution you'd like Add AHTx sensor support to ESP8266 version.

Describe alternatives you've considered Making sensor temperature and humidity read a separate function or class so it can be adjusted based on needs.

Additional context

mmahdium avatar Dec 28 '23 09:12 mmahdium

Hi, Welcome To the duino-coin github!

I think you don't know how to work a few lines of code, if you don't know how to operate the DTH library below I'll teach you

Identify Current Library Usage: Examine your existing code and identify where you are including and using the DTH library. Look for lines like #include <DTH.h> or similar, and functions like DTH.readTemperature() or DTH.readHumidity().

Find and Install the New Library: Locate the library for your new sensor (in this case, the AHT sensor library). Download it and install it using the Arduino IDE Library Manager or manual installation, as explained in the library's documentation.

Update Include Statements: Replace the old library include statement with the new one. For example, if you were using the DTH library, you might have something like:

#include <DTH.h> Replace it with:

#include <AHT.h> // Or the actual name of the AHT library Update Object Initialization: If your code creates an object for the DTH sensor, modify it for the AHT sensor. For instance, if you had:

DTH dthSensor;
Change it to:

AHT ahtSensor;  // Or the actual name of the AHT sensor object
Update Function Calls:

Search for instances where you are calling functions from the DTH library, and update them for the AHT library. For example, if you had:

float temperature = dthSensor.readTemperature();
Change it to:

float temperature = ahtSensor.readTemperature();

Verify Compatibility: Make sure that the functions and methods you are using from the AHT library have similar parameters and return types as those from the DTH library. If there are differences, adjust your code accordingly.

Compile and Test: After making these changes, compile your code and upload it to your Arduino board. Monitor the serial output to ensure that the AHT sensor is providing the expected temperature and humidity readings.

Always refer to the documentation provided with the specific sensor libraries for accurate information on usage and function calls.

lucassobralofc avatar Dec 28 '23 18:12 lucassobralofc

Hi, Appreciate that detailed documentation. I have already added that to my code but i opened this issue to just suggest adding it officially so people with less knowledge can use AHTx sensors with their gear.

mmahdium avatar Dec 31 '23 10:12 mmahdium