It's OK to connect Anode to V+ OR Cathode to 0V but if both are connected, it will not limit IR Diode current and burn out inside. ( Test with DMM in diode test mode for 1V or so with + on Anode) The proper way to test is to use a series R in either Anode or cathode connection to V+ and 0V and operate at 10mA and no more than 20mA using Ohm's Law such as (5V-Vf=1.2)/380 ohm = 10mA. http://www.mouser.com/ds/2/414/OPB917BZ-962256.pdf datasheet