Slotted Optical Switch (OPB992T51Z) anode and cathode connections?
The LED should be powered via the Anode and Cathode pins, the same way any other LED is powered - with a series resistor to limit the LED current to a safe value.