I need to analogread every 4ms, but I tested my code reading the execution time and it printed this:
it's not 4ms, my code:
#include <time.h>
clock_t start,end;
double tempo;
     for(i=1; i <= 20; i++) {
           start=clock();
           x = analogRead (BASE + chan);
           printf("%d\n", x);
           delay(4);
           end=clock();
    tempo=((double)(end-start))/CLOCKS_PER_SEC;
    printf("%f \n", tempo);
    } 

 
    