Arduino and IR

Hey guys. I am trying to read the input from a IR gate switch. All i want to be able to read is everytime i pass something between the two sensors. My sensors have 3 wires, 1 red, 1 black and 1 blue. I assume the red is Vdd and black is Gnd and blue is signal. Any help would be great.

My switch looks like this

My sensors have 3 wires,

But that photo has 4 wires. Is it the same?
What you have here is a slot switch. One side is an LED, connect the cathode to ground and the anode to a 150R resistor with the other end to +5V.

The other side is a photo transistor. Connect the emitter to ground, the collector to a digital input pin, configure it as an input and enable the internal pullup resistor by doing a digitalWrite(pin,LOQW).

However you need to identify what wires on your sensor go to what connections.

One guess might be red to +5, black to ground and blue to the digital input.
BUT the red might have to go through a resistor to +5 if there is not one built in. You need the part number of your switch and look up the data sheet.

Thanks for the info grumpy, I took the black plastic off the circuit and this is how its connected.
Would you know of a sketch that i could use to show the circuit working?

Well I am not sure from that. Is that thing that you think might be a resistor breaking the wire from the blue wire to the pin?

It doesn't exactly stack up with what I thought - close but no coconut as they say.

A photo would be better, but a part number would be best.

code not checked for stupid mistakes, assume you connect it to pin 2

void setup(){
pinMode(2,INPUT);       // pin to connect your sensor to
pinMode(13,OUTPUT);  // built in LED

void loop(){
  if(digitalRead(2) == LOW) digitalWrite(13,LOW); else digitalWrite(13,HIGH);

LED is on when something blocks the slot.

Thanks again grumpy, Yeah the blue wire goes into the suspect resistor then out the other side. The black wire goes under it. Ill see if i can take a picture of it. I would try and find a data sheet but there are not markings on this thing at all. I pulled it out of an old lexmark sheet tray.

I run the sketch and i get no change in the led. I do if i unhook the ground cable from the slot switch. Here are the pictures of the switch.

Ok forget about the red wire for the moment and connect the blue and black to + and -. Look at the LED with a digital camera and see what way round the blue and black wires have to be to allow you to see the LED light up.

Wire it that way round and then put the red wire to your arduino (pin2 if you are running that sketch) and try again.

Thanks a million Grumpy that works. I put a video up of it so you could see. Every time I move the gate out of the way the LED lights up.

Thanks for all your help.