HW-006 IR Line Tracker Sensor Module
-
RM3.00
- Product Code: HW-006
- Availability: In Stock
Product use:
1. Pulse data sampling of kilowatt-hour meter
2. Fax machine shredder paper detection
3. Obstacle detection
4. Black and white line detection
Product Introduction:
1, Using TCRT5000 infrared reflection sensor
2. Detection reflection distance: 1mm~25mm applicable
3. Working voltage: 5V
4. Output form: digital signal (0 and 1)
5. With fixed bolt holes, easy to install
6. Small board PCB size: 3.5cm x 1cm
7. Single weight: 4.5g
Function introduction:
The infrared emitting diode of the TCRT5000 sensor continuously emits infrared rays. When the emitted infrared rays are not reflected back or are reflected back but the intensity is not large enough, the infrared receiving tube is always in the off state. At this time, the output end of the module is low, indicating that the diode is always in the off state. When the detected object appears within the detection range, the infrared is reflected back and the intensity is large enough, the infrared receiving tube is saturated, and the output end of the module is high, and the indicating diode is lit.
Connection mode:
1, VCC: connected to the positive electrode of the power supply (5V)
2. GND: Connects to the negative terminal of the power supply
3. OUT: high/low level switching signals (digital signals 0 and 1)
Code:
const int pin_SENSOR = 12; const int pin_LED = 13; int sensorState = 0; int count_value = 0; int prestate = 0; void setup() { pinMode(pin_LED, OUTPUT); pinMode(pin_SENSOR, INPUT); Serial.begin(9600); } void loop() { sensorState = digitalRead(pin_SENSOR); if (sensorState == HIGH && prestate == 0) { count_value++; Serial.println(“EVENT DETECTION COUNT”); Serial.print(“\t”); Serial.println (count_value); digitalWrite(pin_LED, HIGH); delay(500); digitalWrite(pin_LED, LOW); prestate = 1; } else if (sensorState == LOW) { prestate = 0; } }