sensor

i'm trying to figure out how to use a sensor without breaking it :).

it's that photo sensor thingy, with the ir leds facing eachother, and if the beam is broken, it turns off, its that little piece of plastic with the 2 small towers, and i got it out of a printer, and i want to know how to use it with the arduino, as a switch, i cant think of the exact name right now, but any 1 know how to use it?

o yea, and it has 3 pins, i'm guesing 2 anodes, and a common cathode?

thanks
-big93

Its a photo-interrupter. :slight_smile:

Best bet is the middle pin is the output. A digital input should work fine with it.

The trick is figuring out which of the other pins is Vcc and which one is gnd.
Best to get a multimeter on the middle pin and add power with a resistor.
If nothing changes when you break the beam then swap the power leads around.

wow, thats a really good idea!! i'm gonna test it right now, thanks for the help!

and i would connect the multi meter to the middle pin and gnd im guessin?

o yea, p.s in my code, what do i have to add so that my input shows up on the seriall thing.

i kno that serialbegin(9600); is needed in void setup, but then where do i put the function to make the changes show up in my serial port? ( and do i put it after void loop, or in between void loop and setup?)

thanks