Nec 2501 photocoupler

You might also try to ground the Emitter of the Photo transistor and place the load resistor in the collector side from Vcc to the Collector and measure there, A low would indicate that the Diode is turned on, A high would indicate that the voltage on the Anode is below 1.5V. I've used the NEC2501/2/4 in that manner many times with great success. If you need a high to indicate a condition, invert your sketch logic.

Doc