Electronics 101 - Laser Emitter
July 16, 2018
electronics
laser
Parts
- 1x Raspberry PI
- 1x laser emitting diode
- 3x jumper cables
Schematics
IC in the schematics represents the following sensor.
Starting from left to right, connect first pin to GPIO23
, second to 5V
and third to GND
.
Python Code
from gpiozero import LED
from time import sleep
laser_pin = 23 # BCM
timeout = 1 # seconds
laser = LED(laser_pin)
try:
while True:
laser.on()
sleep(timeout)
laser.off()
sleep(timeout)
except KeyboardInterrupt:
laser.off()