Operating the laser is like operating a LED from a GPIO pinout. Except you don’t need a resistor or any packages to install.
The laser only has two leads. One lead is for signal, the other is ground.
Connect the red lead to pin 12 (GPIO 18) on your raspberry pi/Jetson.
Connect the ground wire to pin 14 (Ground) on the pi/jetson.
Create a python3 file called laser.py
#!/usr/bin/env python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(18, GPIO.OUT) for i in range(0,100): print('Led on') GPIO.output(18,GPIO.HIGH) time.sleep(0.5) print('Led off') GPIO.output(18, GPIO.LOW) time.sleep(0.5) GPIO.cleanup()
From the linux terminal, run the program.
The laser output is very weak, shine the laser against a surface and look for a reflection.