Optical Broken Module
Optical Broken Module
DESCRIPTION:
Photo-interrupter, also called optical broken module, is a device that is made up of an
infrared led and a photo transistor with a gap between the two of them. When
something is placed between the gap, the light is cut and the current flow through the
photo transistor is reduced or stopped.
Specification:
● Operation voltage: 5V
● 3Pin
● Size:23.5*14.5mm
● Weight: 1.265g
PIN CONFIGURATION:
1/3
1、 “-”: GND
2、 “+” : +5V
3、 “S” : Signal pin
Example:
In this example, connect the circuit as below, upload the sketch, then put
something between this module, the LED13 will light on.
Code:
int Led=13;
int sensor=3;
int val;
void setup()
{
pinMode(Led,OUTPUT);
pinMode(sensor,INPUT);
}
void loop()
2/3
{
val=digitalRead(sensor);
if(val==HIGH)
{
digitalWrite(Led,HIGH);
}
else
{
digitalWrite(Led,LOW);
}
3/3