Laser Tube Transmitting module & Laser receiving module
Experimental Results
BOM List
Arduino Uno * *
Laser Tube Transmitting Module * *
Laser Receiving Module * *
Bread Plate
Jumper several
Wiring
Arduino Uno <------> Laser Tube Launch module
Pin <------> S (signal pin)
5V <------> +
GND <------>-
Arduino Uno <------> Laser Receive Module Pin 2 <------> out 5V <------ > VCC GND <------> GND
Open Source Code
int LED = 13; Defines the LED pin as 13 (i.e. the LED light on the board) int lasersensor = 2; Define the laser receiver module signal PIN is 2 int sensorreading = high; Defines the laser receiver module signal pin for high-level int Laser = 12; Define the laser emission module signal PIN for the Void Setup () {//Put your setup code here, to run Once:pinmode (LED, OUTPUT); Define LEDs for Output mode Pinmode (Laser, Output); Define laser for Output mode Pinmode (Lasersensor, INPUT); Set to Lasersensor for input mode} void Loop () {//Put your main code here, to run Repeatedly:digitalwrite (Laser, high); Laser beam delay (200) is sent to laser high level. Delay 200 ms Sensorreading = Digitalread (lasersensor); Read the current state of the Lasersensor (laser receive module signal PIN) if (sensorreading = = low)//if equals level {Digitalwrite (LED, high); The light is lit (something is blocked between the transmit and receive)} else {Digitalwrite (LED, low); Otherwise the light is off (no obstructions between transmit and receive)}}