I lost my video of working circuit, but here is my code:


By using the averageValue library, I was able to smooth out the LED brightness changes and make them feel more natural. Instead of instantly reacting to each new distance reading from the sensor, I stored the last 10 brightness values and calculated their average. This way, the LED gradually transitions between brightness levels, avoiding sudden jumps. It makes the visual feedback look much more stable and refined, which is especially important when working with real-world sensor data.
Leave a comment