As mentioned in my previous post, noise from the ADXL335 accelerometer readings result in flickering light. And I don't want that.
(Read the entire post to see chart comparisons of the two filtering methods.)
Here are graphs for two scenarios for both filters. I use a array size of 5 for the moving average and an alpha value of 0.2 for the low-pass filter. The first scenario is an abrupt change from a steady 1.0 value to 0. The other is for noisy data after a steady 0.5 value:
For the noisy data, there is not a lot of difference but the low-pass filter does seem to remove the noise spikes better. However, as can be seen on the one-to-zero transition the low-pass filter will never actually reach the zero value (sure, it will be rounded down to zero at some point).
I think I will try the low-pass filter first. And also implement a "snap to endpoints" function so values close to 1 or 0 will be rounded down or up.