here for Sensor Smoothing

Polling analog temperature sensors once a second needed smoothing and I did not want to loose accuracy or take up Sram with floating point numbers so I chose to use intigers and multiply by 16 rather than 10 using the base formula:

Av n = Val n + (Av n-1)*15/16

It becomes 16Av n = 16Val n + 15(Av n-1) where I want to use (16AV n) further on in the programm to preserve accuracy

so using 16Av n as the variable in the code

becomes 16Av n =  (Val n << 4) + (16Av n-1)- ((16Av n-1)  >> 4)

It seems to work pretty well

Arduino Topics: TaskManager