thesholding for detecting the led