I am trying to use the Spark X 24 bit ADC converter and have it working while using one channel but when I use two things start to not work so great. Right now in my script I have 2 variables myADC_1 and myADC_2, if set both of the input channels the same on both variables (myADC_1.setInputMultiplexer(ADS1219_CONFIG_MUX_DIFF_P2_N3) and myADC_1.setInputMultiplexer(ADS1219_CONFIG_MUX_DIFF_P2_N3)) then the when using the command myADC_1.readConverison() and myADC_2.readConverison() the values displayed are the same but if I use myADC_1.setInputMultiplexer(ADS1219_CONFIG_MUX_DIFF_P0_N1) and myADC_1.setInputMultiplexer(ADS1219_CONFIG_MUX_DIFF_P2_N3) the values displayed are still the same. Is it not possible to read off of 2 differential connections at the same time? If not I could just use 2 ADC and assign different address in I2C but I was hoping to only use one ADC.
If you are creating two instances of the ADC object (SfeADS1219ArdI2C) they will unfortunately fight over the ADC…
If I understand what you are trying to do correctly, why not simply:
myADC.setInputMultiplexer(ADS1219_CONFIG_MUX_DIFF_P0_N1);
myADC.startSync(); // Start a single-shot conversion.
while (myADC.dataReady() == false) // Check if the conversion is complete. This will return true if data is ready.
{
delay(10); // The conversion is not complete. Wait a little to avoid pounding the I2C bus.
}
myADC.readConversion();
float milliVolts01 = myADC.getConversionMillivolts();
myADC.setInputMultiplexer(ADS1219_CONFIG_MUX_DIFF_P2_N3);
myADC.startSync(); // Start a single-shot conversion.
while (myADC.dataReady() == false) // Check if the conversion is complete. This will return true if data is ready.
{
delay(10); // The conversion is not complete. Wait a little to avoid pounding the I2C bus.
}
myADC.readConversion();
float milliVolts23 = myADC.getConversionMillivolts();