Example Code for Serial Port Assistant-Read Distance
This article offers a comprehensive guide on using Serial Port Assistant to measure distances, detailing hardware and software setups, wiring instructions, and expected results with a laser sensor and multi-function module.
Hardware Preparation
- 6-in-1 multi-function to serial port module
- Laser Ranging Sensor UART 4m × 1
Software Preparation
- Serial Assistant
Wiring Diagram
Turn the mode of 6-in-1 multi-function to serial port module to USB to TTL, as shown below:
| Mode | Dial code 1 (USB) | Dial code 2 (485) | Switch S1 | Diagram |
|---|---|---|---|---|
| USB to TTL | ON | OFF | Down (232-485) | ![]() |
Other Preparation Work
Connect the sensor to 6-in-1 multi-function module, then plug the module into the usb port of computer, open the serial assistant, select Baud rate 1152000, untick HEX display and open the serial port.
Result
It will directly output distance value as shown below.

Was this article helpful?

