Hmm, I don't know Bill.
I've had a play with your code, and I'm not sure about it.
It does seem to pick a valid point in-between two samples. But it only averages that point, and the previous point found between two other samples. It's not averaging all the samples, so it's still very jumpy.
Your explanation describes EEPROM locations up to 29, but there are only 15 DATA values, although I don't think that affects the problem.
I've modified the program a bit to use the Average as the X value, then read the samples one at a time, also connected a POT to simulate the wind vane, but I get the same results.
Another hiccup, if the average is currently 10, then it receives a string of 255 samples, it stops at 1, and never crosses 0. And for many other samples, it stops 1 number away from the actual reading. 250 might stop at 249 or 251.
I think finding a point in-between 2 samples is fairly easy. But averaging a large number of samples is something altogether different, and a 2-sample average just doesn't do it.
Aratti,
The ATN function is actually an ATAN2 type since it works for all four quadrants. An arctangent would only work with 1 quadrant.
The format of the statement is ...
Result = X ATN Y
There aren't any other "math signs" involved.
<br>
Bookmarks