Originally Posted by
Bill Legge
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.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks