Hello, in a project, advancedADC were used, on pin A0 and A5, to read two sensors, and A5 pin to controll a sensor enable signal. Somehow the action on A3 pin seem to intefere the A5. Please see the following test code for details. Thanks in advance for your help.
#include <Arduino_AdvancedAnalog.h>
#define nBuffers 32
#define nSamples 1000
#define samplingFreq 100
AdvancedADC adc1(A0);
AdvancedADC adc2(A5);
void setup() {
Serial.begin(9600);
while (!Serial);
if (!adc1.begin(AN_RESOLUTION_16, samplingFreq*nSamples, nSamples, nBuffers)) { //this somehow overwrites D1 to HIGH and thus placed before pwm setup
Serial.println("Failed to start adc1(A0)!");
while (1);
}
if (!adc2.begin(AN_RESOLUTION_16, samplingFreq*nSamples, nSamples, nBuffers)) { //this somehow overwrites D1 to HIGH and thus placed before pwm setup
Serial.println("Failed to start adc2(A5)!");
while (1);
}
// digitalWrite(A3, HIGH);
}
void loop() {
if (adc2.available()){
SampleBuffer buf = adc2.read();
for (int i=0; i < buf.size(); i++){
Serial.println(buf.data()[i]);
}
buf.release();
}
}
adc2 produces correct results in the code above. However, if line 21, "// digitalWrite(A3, HIGH);" is uncommented, A5 pin have 3.1 V read by a multimeter and not connected to anything else. And adc2's reading doesn't respond to signals applied to A5 pin anymore.