Hi all,
How to determine the sampling rate of ADC of arduino mega 2560?
Sampling for 10 bits
This should get you an average sampling time over 1000 samples (approximately). note code was written off the top of my head and as such may need debugged!
void setup(){
Serial.begin(9600);
unsigned int tempData = 0;
long duration = micros();
for (int i=0; i<1000; i++){
tempData = analogRead(A1);
}
duration = micros() - duration;
float frequency = 1000000./(duration/1000.);
Serial.print("Sample Frequency = ");Serial.println(frequency,3);
}
void loop(){
}
forgot to mention that faster analog sampling can be done
The Uno and Mega have the same ADC, default set up is 110us per conversion. On the Mega
there are more pins that can be multiplexed to the ADC, but its otherwise identical performance.
What are you actually trying to do?