Difference between revisions of "Template:Laser Sensor Arduino Guide"

From Waveshare Wiki
Jump to: navigation, search
m (Text replacement - "https://www.waveshare.com/w/upload/" to "https://files.waveshare.com/upload/")
 
Line 18: Line 18:
 
Double-click to open the Laser_Sensor.ino file.<br/>
 
Double-click to open the Laser_Sensor.ino file.<br/>
 
Select your development board and the corresponding port.<br/>
 
Select your development board and the corresponding port.<br/>
[[File:Laser Sensor Arduino.jpg]]<br/>
+
[[File: MQ5 Arduino 1.jpg]]<br/>
 
Compile and download, as shown below:<br/>
 
Compile and download, as shown below:<br/>
 
After the download is successful, run SSCOM to connect the Laser module, and you can view the status of the sensor in real-time.<br/>
 
After the download is successful, run SSCOM to connect the Laser module, and you can view the status of the sensor in real-time.<br/>

Latest revision as of 08:21, 13 April 2024

The Arduino example is written for the Arduino UNO. If you want to connect it to other Arduino boards, you may need to change the connection.

Arduino

Hardware connection

Sensor Arduino Description
VCC 5V Power input
GND GND Power ground
DOUT D2 Digital output
Laser Arduino 2.jpg

Install the Software

Run the Program

Download the program in the information we provided, unzip it, and then enter the Laser-Sensor-code/Arduino/Laser_Sensor directory.
Double-click to open the Laser_Sensor.ino file.
Select your development board and the corresponding port.
MQ5 Arduino 1.jpg
Compile and download, as shown below:
After the download is successful, run SSCOM to connect the Laser module, and you can view the status of the sensor in real-time.
Laser Sensor Arduino02.png

Note

Place the obstacle above the laser sensor, and the signal indicator on the module will be on. When the obstacle is far away from the laser sensor, the signal indicator on the module will be off.
Note: Try to avoid touching the resistors and capacitors on the board when the power is on, to avoid burning out the infrared emitting tube, the laser is harmful to the human eyes, please do not use it to irradiate the human eyes!