Infrared counter-beam counting sensor/slot-type photocoupler speed measurement light-break sensor module With XH2.54 3P Socket
1. Overview
This sensor is an Arduino specific sensor, and its connection port is compatible with Arduino sensor expansion boards. It is mainly composed of a photointerrupter, which belongs to the category of photoelectric switch optical switch sensor with opposing interruption. The sensor comes with 2 positioning holes, making it convenient for you to fix the sensor on other devices.
2. Specification parameters
Working voltage: 3.3-5V (DC)
Interface: 3PIN interface
Output signal: digital signal
Weight: 3.2g
![]()
4. Test code
int Led = 13 ;// Define Number Port 13
int buttonpin = 3; // Define Number Port 3
int val ;// Define the numerical variable val
void setup ()
{
pinMode (Led, OUTPUT) ; // Set LED as output
pinMode (buttonpin, INPUT) ;// Set buttonpin as input
}
void loop ()
{
val = digitalRead (buttonpin) ;// Read the value from port 3 and assign it to val
If (val==HIGH)//When val is at a high level, the LED lights up
{
digitalWrite (Led, HIGH);// LED lights up
}
else
{
digitalWrite (Led, LOW);// LED dimming
}
}
5. Test results
Connect the wires as shown in the diagram, burn the code, and after powering on, the D1 light on the module lights up and the LED indicator light on the D13 on the Arduino UNO board turns off; After blocking the module groove with a piece of paper, the D1 light on the module will turn off, and the LED indicator light of D13 on the Arduino UNO board will light up.
Hot ProductsNew Products For May
Recently ViewedRelated Product
|