i'm using the ping sensor to control the brightness of LEDs. i'm checking distances and if within a range setting a flag triggers the LEDs to be brightened or faded by 1 each loop of the program. however - if i'm right at the edge of the range and the sensor values are jumping by one, it causes the LEDs to flicker. any suggestions on refining my code to avoid this? should i be averaging values to smooth it out?