I spent way too long on this- I had a very hard time figuring out how to get the LED and the sensor to work together. They would work fine by themselves, but once linked together, something would break.
Thankfully, I finally solved the problem to some degree. Not so thankfully, my room now smells like rotten oranges.
Here is my code: