Using Multiple ADS1X15 on Single ESP32

Hello, I have been using a single ADS1115 on an esp32 with the Adafruit library:

Adafruit_ADS1X15.h

I now need to add a second one as I need to measure 6 things.

I have tried to find how to address multiple ads using the arduino interface and this library, and all have given the solution as:

Adafruit_ADS1115 ads0(0x48);
Adafruit_ADS1115 ads1(0x49);

However I get an error: no matching function for call to 'Adafruit_ADS1115::Adafruit_ADS1115(int)'

It will let me define multiple ads like below:

Adafruit_ADS1115 ads0;
Adafruit_ADS1115 ads1;

and call functions with each like this:

adc0 = ads0.readADC_SingleEnded(0);
adc1 = ads0.readADC_SingleEnded(1);
adc2 = ads0.readADC_SingleEnded(2);
adc3 = ads0.readADC_SingleEnded(3);
results = ads1.readADC_Differential_0_1();

but how would I know or dictate which address each corresponds to?

Each will be doing different things and be wired in with their addresses via a wire to gnd or vdd, so i need to know which ads the function is pointing to.

Any guidance would be appreciated.

can you share a link to the library you used?

seems you can use the begin() method to pass the I2C address

Hi, The library I used is this one: GitHub - adafruit/Adafruit_ADS1X15: Driver for TI's ADS1015: 12-bit Differential or Single-End

It was the only one for the ADS1x15 made by adafruit I could find.

But looks like you nailed it, that seems to work using:

ads0.begin(0x49);
ads1.begin(0x48);

Thank you very much for the help!

great ! :wink:
have fun