Issues with IR detection

Jlawler:
Thanks so much!, It works perfectly. If I may ask, why did noTone fix it?

Awesome, that is great to hear :slight_smile:
As for it works: without getting too technical, if the sensor is exposed to the correct IR radiation for too long it automatically cuts off. This is to stop it from responding to high levels of background IR. Adding the noTone() shuts off the IR LEDs for a bit and allows the sensor to 'reset' for the next time you check it.