I am back for more help. I have got an opto switch from a friend which I hope I can use, but I do not know how to connect. From the attached data I think pin 1 and 4 is grounded and pin 3 is the output getting 5v through a 10 000 ohm resistor, but where and how is pin 2 connected used? Any help will be appreciated.