About the Arduino and the H21A optical interruptor switch
Arduino is an open electronics development platform. It is widely used to power electronics projects. There are several boards that feature different capabilities. In my case, I am using an Arduino R3.
The H21A optical interruptor switch is a common piece of hardware. It is composed of an IR led and a photoresistor.
My goal is to use an Arduino to detect when the light is interrupted. As I am a newcomer to electronics and arduino, I started by looking on the internet for information on how to connect the two.
Some examples found on the internet
I found this search result to be relevant : http://www.electroschematics.com/10494/arduino-optical-position-rotary-encoder/
However, it did not worked, maybe because I did not had the recommended resistors at hand.
The solution that I found to be working is to simply connect the output pin of the H21A to a digital input pin of the Arduino. The trick is to declare the pin as "INPUT_PULLUP", this removes the need for a pull-up resistor ! :-)
Hope this helps !