const int SMOOTH_POWER = 3; ... value = ((value << SMOOTH_POWER) + (analog_read(0) - value))>> SMOOTH_POWER;