im trying to read two analog input signals , ive used 12 resolution adc function, but the max value it gives is 2500 whereas it should be between to 4095. `
`const int first=A0;
const int second=A1;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
analogReadResolution(12);
}
void loop() {
// put your main code here, to run repeatedly:
int value1=analogRead(first);
int value2=analogRead(second);
Serial.print(value1);
Serial.print(",");
Serial.println(value2);
}
Please fix your attempt at code tags. Code tags (in their basic form) are three back ticks (```) before and after the code; they should be on their own line.
Have you verified the signal level of the signal generator with a scope? Is the max. 3.3V? I hope the signal does not go negative (e.g. sin wave) as that might damage the Due.
You can test the ADC by connecting your analogue input to GND (reading should be around 0) and to 3.3V (reading should be around 4095).
Lastly you can try to place a short delay between the readings of the analogue inputs and see if it improves the situation; e.g.
void loop() {
// put your main code here, to run repeatedly:
int value1=analogRead(first);
delay(100);
int value2=analogRead(second);
delay(100);
Serial.print(value1);
Serial.print(",");
Serial.println(value2);
}
during the first 2 simulation i might have given negative sine signal to due as i was a complete newbie, but later i started giving offset to ensure the signal is well above 0. could it have damaged the board?