I'm trying to capture a lot of analog data over shortest possible time. Was working on standard Arduino Uno, but after testing, it's too slow - 5000 consecutive analog reads takes 560ms. Then I thought about my Feather M0 - with much faster processor speed.
I've quickly connected it, uploaded the same code I've used on Uno board and... 5000 reads is taking 2117 ms! :O
Pasting my test code - did I'm missing something, or it really is slower than Uno? :/
Code: Select all
void loop() {
unsigned long startTime = 0;
unsigned long endTime = 0;
int sensorValue = 0;
startTime = micros();
for (int i=0; i<5000; i++) {
sensorValue = analogRead(A0);
};
endTime = micros();
Serial.print("Time: ");
Serial.print( float (endTime-startTime)/1000.0 );
Serial.print(" ms");
Serial.print("\n");
Serial.print("Last value: ");
Serial.print(sensorValue);
Serial.print("\n\n");
}