Hi guys,
i'm quite new to the community, so i'm not sure if this is the right section for my issue.
i believe it's a programming issue with the analogRead function. I have the impression, when reading out both AD0 and AD1 together, they read out the same values although there are different voltages applied to the pins
i'm using the Arduino Due board and have the following schematic

when i read out the AD0, i get the following results while tapping the electret microphone
only PIN_ANALOG_IN_1
micro val:122
micro val:429
micro val:623
micro val:814
micro val:739
micro val:1023
when i try to read AD1, i get the following (while rotating the potentio meter (1OK)
only PIN_ANALOG_IN_2
trigger signal:652
trigger signal:641
trigger signal:632
trigger signal:622
trigger signal:609
trigger signal:587
trigger signal:560
trigger signal:537
trigger signal:525
trigger signal:519
trigger signal:514
when i try to read them both immediately the one after the other, i read the following when tapping the electret, the potentiometer doesnt budge..
both
trigger signal:1023 micro val:632
trigger signal:700 micro val:0
trigger signal:0 micro val:869
trigger signal:885 micro val:985
trigger signal:991 micro val:730
i have the following code (left some extra code in there because maybe the array influences the memory locations in which the analogread stores it values ???
#define PIN_ANALOG_IN_1 0 // electret microphone for listining
#define PIN_ANALOG_IN_2 1 // potmeter for scaling factor
#define BUFFER_ANALOG_IN_1 64
////Pin connected to DS of 74HC595
int dataPin = 22;
//Pin connected to SH_CP of 74HC595
int clockPin = 26;
//Pin connected to ST_CP of 74HC595
int latchPin = 24;
int button = 23;
int arr_analogval[BUFFER_ANALOG_IN_1];
int arr_74HC595[2];
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(button, INPUT);
digitalWrite(button, LOW);
// init arr_74HC595
arr_74HC595[0] = 0X00;
arr_74HC595[1] = 0X00;
// clear 74HC595
digitalWrite(latchPin, LOW); delay (1);
shiftOut(dataPin, clockPin, LSBFIRST, arr_74HC595[1]); delay (1);
shiftOut(dataPin, clockPin, LSBFIRST, arr_74HC595[0]); delay (1);
digitalWrite(latchPin, HIGH); delay (1);
// end of setup
Serial.println("OK");
}
void loop() {
float signal_factor = 0;
float trigger_factor = 0;
int avg_analogval = 0;
Serial.print("\t trigger signal:"); Serial.print(analogRead(PIN_ANALOG_IN_2));
avg_analogval = analogRead(PIN_ANALOG_IN_1);
Serial.print("\t micro val:"); Serial.print(avg_analogval);
Serial.println("");
}
i tried a quick google but nothing apparent came out of this
hope someone has encountered the same issue and can enlighten me
CHeers!
H.