Quote Originally Posted by Bill Legge View Post
I suspect the answer to my problem will be embarrasingly simple?

I am using a rotary pot fixed to a wind vein to record wind direction.
Assume that NORTH is 0 on the A/D reading [Maximum 255]

I want to average, say two readings, to smooth the results:

Reading 1 = 255, Reading 2 = 1, Average = 128 [ i.e SOUTH]
Reading 1 = 128, Reading 2 = 128, Average = 128 [SOUTH again]

Any ideas please? Sorry if this is an idiot question!

Regards Bill legge
Not an idiot question, the answer might be . . . .
store the values in a word variable, i e reading = (reading + reading) / 2
so reading1 = 255 + reading2 =256/2 = 128 . You can oversample several times to increase accuracy.