arduino - Measure max rate of ADC samples in one second -


does have code snippet measure max rate of adc samples achievable in 1 second. understand there millis()function in arduino.

unsigned long start, finsihed, elapsed;  void setup() {   serial.begin(115200); }  void loop() {   int sensorval = analogread(a0);   serial.println(sensorval);   serial.println("start...");   start = millis();   serial.println("finished");   elapsed = finished - start;   serial.print(elapsed);   serial.println(" milliseconds elapsed");   serial.println(); } 

if trying figure out maximum number of times can process , adc in 1 second should try besides printing out value every time!

for instance use loop counts 1 every 10,000 times have read e.g.

start = millis() for(int = 0; < 10000; i++){      analogread(a0);  } finish = millis() total = start - finish print("this trail took "); print(total); print(" miliseconds!"); 

coincidentally 10,000 number of times data sheet here tells arduino can run analog read second!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -