RunningAverage Class on playground (updated)

robtillaart:

But I still wonder if the array size can be made user configurable during runtime.

The lib could be rewritten to use dynamic memory and you could reallocate the memory. However as an Arduino has very limited RAM this gives fragmented (useless) memory quite fast.

that said, you might try with largest allocation first and gradually decrease the size to an optimum. Then the reallocation should less fragment the memory in theory ...

That's true, but it's already implemented with my library (I use a self made LinkedList). Worth a try =)

You can change the size whenever you want, and it will not crash the code.

Also, you can use it with basic numbers 10 = Gaussian(10); or with numbers with variance: Gaussian(10,variance);, witch gives you much more flexibility on the average...

Just a tip... take a look at the documentation.