Two things.
-
This is a digital device, so the output should be connected to a digital pin.
-
It has an open collector output, so it needs a pull up resistor to 5volt.
Or, easier, enable the internal pull up resistor on the pin in setup().
pinMode(PhotoPin, INPUT_PULLUP);
Leo..