In this example we take a look at the KY-010 Photo Interrupter Module and connect this to a Raspberry Pi.
The sensor uses a beam of light between the emitter and the detector to check if the path between both is being blocked by an object
We use pin 40 (GPIO 21) in this example, you can use another GPIO pin.
|KY-010 module||Raspberry Pi|
|S (right)||Pin 40|