Welcome to Laser Ranging Module repository
2. Digital tube display distance
1. Learning target
In this course, we will earn how to use Arduino and laser ranging module to achieve ranging, and display distance on digital tube module.
2. Preparation
Connect the module to Arduino board as shown below.

3. Program analysis
3.1 Initialize the serial port, initialize I2C, initialize the mode.
Then start the ranging.
During initialization, three ranging modes are realized by setting the initialization mode.
3.2 After getting the current ranging result, print out the data through the serial port and display data on digital tube module.
4. Compiling and downloading code
4.1 We need to open the .ino file by Arduino IDE software. Then click“√”under the menu bar to compile the code, and wait for the word "Done compiling " in the lower left corner, as shown in the figure below.
4.2 In the menu bar of Arduino IDE, we need to select 【Tools】---【Port】--- selecting the port that the serial number displayed by the device manager just now, as shown in the figure below.


4.3 After the selection is completed, you need to click “→”under the menu bar to upload the code to the UNO board. When the word “Done uploading” appears in the lower left corner, the code has been successfully uploaded to the UNO board, as shown in the figure below.

5. Phenomenon
After the program is downloaded successfully, the program will be automatically initialized and calibrated according to the current environment.
Then, the digital tube will display the currently detected distance.