Arduino Uno Laser transmitter and receiver module sensor applications

Source: Internet
Author: User

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)}} 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.