I am having difficulty understanding the smoothing code on the arduino site (can't link, forum won't let me). I'm smoothing some IR sensor readings and it seems to do it quite well, I just haven't the foggiest idea on how it works. I think I might be being a bit thick.
Could someone please explain how it works to me? I can't even get it from examining the comments.
My main concern is that since I am making a segway type thing, that if one of the numbers rolls over or something I'll end up being curbstomped by my own creation. Could this happen, and if it could would it take so long that it wouldn't happen within the battery life anyway?
I tried to write some of my own code that used an array which repeatedly updated and was averaged out, but that failed miserably. If you have any simpler smoothing code that I could have a look at, that would help me loads.