KY-010
KY-010 is Light barrier-module manufactured by Joy-IT.
- Part of the KY-010-Joy comparator family.
- Part of the KY-010-Joy comparator family.
description
1 3 Pinout 2 4 Code example Arduino 2 5 Code example Raspberry Pi 3
Picture
Technical data / Short description
The connection between both input pins will be interrupted if the optical barrier is beeing interrupted.
Export: 16.06.2017
Copyright by Joy-IT
- Published under CC BY-NC-SA 3.0
Page 43 of 214
KY-010 Light barrier-module
Pinout
Code example Arduino
In this program, a LED will flash up, if a signal was detected at the sensor. You can also use the modules KY011, KY-016 or KY-029 as LEDs. int Led = 13 ;// Declaration of the LED-output pin int Sensor = 10; // Declaration of the Sensor-input pin int val; // Temporary variable void setup () { pin Mode (Led, OUTPUT) ; // Initialization output pin pin Mode (Sensor, INPUT) ; // Initialization sensorpin } void loop () { val = digital Read (Sensor) ; // The current signal at the sensor will be read. if (val == HIGH) //The led will flash up, if a signal was detected. { digital Write (Led, HIGH); } else { digital Write (Led, LOW); } }
Connections Arduino:
LED + LED Sensor Signal Sensor +V Sensor
- = [Pin 13] = [Pin GND] = [Pin 10] = [Pin 5V] = [Pin GND]
Export: 16.06.2017
Copyright by Joy-IT
- Published under CC BY-NC-SA 3.0
Page 44 of 214
KY-010 Light barrier-module Example program download Sensor Test_Arduino_inverted
Code example Raspberry Pi
# Needed modules will be imported and configured import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) #...