hello,
i need an infinite loop like arduino loops that do somthings for specified time without freezing app.
i need to get mic samples in a loop for 20ms and then calc average of samples like this arduino code :
please, help me .
regards
i need an infinite loop like arduino loops that do somthings for specified time without freezing app.
i need to get mic samples in a loop for 20ms and then calc average of samples like this arduino code :
C:
start = millis(); // millis() Returns the number of milliseconds passed since the Arduino board began running the current program in arduino
reader = 0 ;
n = 0 ;
while (millis() < start + 20 )
{
reader = reader + A.AudioMaxAmplitude/2700.0 ;
n = n + 1 ;
}
reader = reader / n ; // I got an average
please, help me .
regards