IR Beam Based Object Crossing Detector

Restrict the view of the LDR to block out or reduce effects from ambient light.

Did you try using the photodiode to ground a pin moded INPUT_PULLUP? How close did you have to hold the IR led and was it lit?

Search for: techwalla How to Use a Photodiode

It has step by step with pictures.

I just didn't like the fact that the ambient light in the room drove large variations in how this worked.

You have to use modulated IR for that.

Take a look at this if you want to avoid making much circuitry.