Smooth Transistion From Torch to Off State In the case when the intensity of light goes above and below the threshhold value frequently the light also flashes frequently to prevent that we take the average of ten values and then compare average to threshold