// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(oATemp);
delay(10);
}
// average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES
As far as I can tell, the array you have used here just isn't needed. The array gets filled with readings from an analog pin, but then the only thing that gets used for is to total up the values to calculate the average. That can be done without the array:
// take N samples in a row, with a slight delay
// and average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += analogRead(oATemp);
delay(10);
}
average /= NUMSAMPLES;