While working with Millis loop is there anyway a counter can be added? I don’t seem to be getting the counter added out of it correctly, yes I am new. I am trying to pull the average of the sample.
while (millis() - startMillis < SAMPLE_WINDOW)
{
sample = analogRead(MIC_PIN);
sampleAdd = sample + sampleAdd;
countSample = countSample + 1;
}
sampleAvg = sampleAdd / countSample;
countSample = 0;